Codeforces Beta Round #95 (Div. 2), problem: (A) cAPS lOCK:
http://codeforces.com/problemset/problem/131/A
Codeforces Beta Round #95 (Div. 2), problem: (A) cAPS lOCK solution: http://ideone.com/ti8FJu
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main() {
int a;
char s[105];
a=0;
scanf("%s", s);
for(int i=0; i<strlen(s); i++) if(s[i]<91) a++;
if(s[0]>96 && a==strlen(s)-1) {
printf("%c", s[0]-32);
for(int i=1; i<strlen(s); i++) printf("%c", s[i]+32);
}
else if(a==strlen(s)) for(int i=0; i<strlen(s); i++) printf("%c", s[i]+32);
else printf("%s", s);
return 0;
}
No comments:
Post a Comment