2 solutions
-
1
#include #include
using namespace std;
string s; int n;
string calc(string s){ if (s[0]>='a' && s[0]<='z') s[0] = s[0] - 'a' + 'A'; for (int i=1;i<s.length();i++) if (s[i]>='A' && s[i]<='Z') s[i] = s[i] -'A' + 'a'; return s; }
int main(){ cin >> n; for (int i=1;i<=n;i++){ cin >> s; cout << calc(s) << endl; } }
-
-1
#include #include using namespace std; string s; int n; string calc(string s){ if(s[0]>='a'&&s[0]<='z') s[0]=s[0]-'a'+'A'; for(int i=1;i<s.length();i++) if(s[i]>='A'&&s[i]<='Z') s[i]=s[i]-'A'+'a'; return s; } int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>s; cout<<calc(s)<<endl; } }
- 1
Information
- ID
- 6932
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 1
- Tags
- # Submissions
- 50
- Accepted
- 38
- Uploaded By