-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcaps_lock.cpp
50 lines (44 loc) · 988 Bytes
/
caps_lock.cpp
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
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define fast_io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fr(i,a,b) for (int i =a;i<b;i++)
#define loop(x,n) for (int x = 0;x<n;++x)
#define mod 1000000007
#define inf (1LL<<60)
#define all(x) (x).begin(), (x).end()
using namespace std;
void precal(){
}
void solve(){
string s;
cin>> s;
bool check = true;
for (int i =1;i<s.size();i++){
if(toupper(s[i])!=s[i])check=false;
}
if(check!=false){
if(s[0]==toupper(s[0])){
for(auto &i:s)i=tolower(i);
}
else{
s[0]=toupper(s[0]);
for (int i =1;i<s.size();i++)s[i]=tolower(s[i]);
}
}
cout<<s<<"\n";
}
int main(){
fast_io;
cout<<fixed;
cout<< setprecision(10);
precal();
int t =1;
// cin>> t ;
for (int i =1;i<=t;i++){
// cout<< "Case #"<<i<<": ";
solve();
}
return 0;
}