-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCapsLock.cpp
More file actions
43 lines (40 loc) · 919 Bytes
/
CapsLock.cpp
File metadata and controls
43 lines (40 loc) · 919 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
// https://codeforces.com/problemset/problem/131/A
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <string>
#include <bits/stdc++.h>
#include <cstdint>
#include <map>
#include <unordered_map>
#define ll long long
#define u64 uint64_t
#define i64 int64_t
using namespace std;
void solveCase() {
string str;
cin >> str;
bool capOn = true;
for (int i = 1; i < str.length(); i++)
if (str[i] >= 'a' && str[i] <= 'z') {
capOn = false;
break;
}
if (capOn) {
str[0] = (str[0] >= 'A' && str[0] <= 'Z') ? str[0]-'A'+'a' : str[0]-'a'+'A';
for (int i = 1; i < str.length(); i++)
str[i] = str[i]-'A'+'a';
}
cout << str << '\n';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int nC = 1;
// cin >> nC;
while (nC--) {
solveCase();
}
return 0;
}