-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeforces_CapsLock.cpp
More file actions
54 lines (34 loc) · 805 Bytes
/
Codeforces_CapsLock.cpp
File metadata and controls
54 lines (34 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <bits/stdc++.h>
using namespace std;
int main() {
string word;
cin >> word;
bool needChange = true;
if(word.length() > 1) {
for(int i = 1; i < word.length(); i++) {
if(word[i] >= 'a' && word[i] <= 'z') {
needChange = false;
break;
}
}
}
else {
if(word[0] >= 'a' && word[0] <= 'z') {
word[0] -= 32;
needChange = false;
}
}
if(needChange) {
if(word[0] >= 'a' && word[0] <= 'z') {
word[0] -= 32;
}
else {
word[0] += 32;
}
for(int j = 1; j < word.length(); j++) {
word[j] += 32;
}
}
cout << word << endl;
return 0;
}