手速题
#include <bits/stdc++.h> using namespace std; #define For(i,n) for(int i=1;i<=n;i++) #define Rep(i,n) for(int i=0;i<n ;i++) #define MAXN (100000) string s; int main() { //freopen("1.in.cpp","r",stdin); bool t=true; while (getline(cin,s)) { int l=s.length(); for (int i=0;i<l;i++) { if (t) { if (!isalpha(s[i]) && !(s[i]<='9' && s[i]>='0')) {printf("%c",s[i]);continue; } if (s[i]<='9' && s[i]>='0') {t=false;printf("%c",s[i]);continue; } s[i]=toupper(s[i]); printf("%c",s[i]); t=false; continue; } if (!t) { if (s[i]=='.') { printf("%c",s[i]);t=true; } else printf("%c",tolower(s[i])); } } cout<<endl; } return 0; }
Chang'an(YY's string-模拟)
时间: 2024-10-29 10:45:46