#include<bits/stdc++.h>
#define i64 long long
#define mx(a,b,c) max(a,max(b,c))
#define mn(a,b,c) min(a,min(b,c))
#define eef else if
#define ff(i,s,e) for(int i=(s); i<e; i++)
#define ff2(i,s,e) for(int i=(s); i>=e; i--)
#define sf scanf
#define pf printf
#define dbug(x) cout<<"x = "<<x<<endl
#define newl cout<<"\n"
#define putcase cout<<"Case "<<++cse<<":"
using namespace std;
int main()
{
string s;
while(cin>>s){
bool flag=true;
int length=s.size();
if(s.size()>1){
for(int i=1; i<length; i++){
if(islower(s[i])>0){
flag=false;
break;
}
}
if(islower(s[0])>0 && flag==true){
s[0]=toupper(s[0]);
cout<<s[0];
for(int i=(int)1; i<length; i++){
s[i]=tolower(s[i]);
cout<<s[i];
}
}
else{
if(isupper(s[0])>0 && flag==true){
ff(j,0,length){
s[j]=tolower(s[j]);
cout<<s[j];
}
}
else{
// s[0]=toupper(s[0]);
// cout<<s[0];
ff(j,0,length){
cout<<s[j];
}
}
}
}
else{
if(isupper(s[0])>0){
s[0]=tolower(s[0]);
}
else
s[0]=toupper(s[0]);
cout<<s[0];
}
newl;
}
return 0;
}
#define i64 long long
#define mx(a,b,c) max(a,max(b,c))
#define mn(a,b,c) min(a,min(b,c))
#define eef else if
#define ff(i,s,e) for(int i=(s); i<e; i++)
#define ff2(i,s,e) for(int i=(s); i>=e; i--)
#define sf scanf
#define pf printf
#define dbug(x) cout<<"x = "<<x<<endl
#define newl cout<<"\n"
#define putcase cout<<"Case "<<++cse<<":"
using namespace std;
int main()
{
string s;
while(cin>>s){
bool flag=true;
int length=s.size();
if(s.size()>1){
for(int i=1; i<length; i++){
if(islower(s[i])>0){
flag=false;
break;
}
}
if(islower(s[0])>0 && flag==true){
s[0]=toupper(s[0]);
cout<<s[0];
for(int i=(int)1; i<length; i++){
s[i]=tolower(s[i]);
cout<<s[i];
}
}
else{
if(isupper(s[0])>0 && flag==true){
ff(j,0,length){
s[j]=tolower(s[j]);
cout<<s[j];
}
}
else{
// s[0]=toupper(s[0]);
// cout<<s[0];
ff(j,0,length){
cout<<s[j];
}
}
}
}
else{
if(isupper(s[0])>0){
s[0]=tolower(s[0]);
}
else
s[0]=toupper(s[0]);
cout<<s[0];
}
newl;
}
return 0;
}
No comments:
Post a Comment