链接:https://www.nowcoder.com/acm/contest/122/A
来源:牛客网
题目描述
Each id has its initial password.
Do the following two jobs at the same time:
1.Turn uppercase letters to lowercase letters
2.Turn lowercase letters to uppercase letters
You can get the initial password for the id.
输入描述:
The input consists of one or more identities(ID), one per line.
The length of each id is between 1 and 100. Each id only consists of letters and digits.
输出描述:
For each id, output the corresponding initial password.
输入
JDJhadjsazA ksfjkkdSDJ23
输出
jdjHADJSAZa KSFJKKDsdj23
1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 #include<cstring> 5 using namespace std; 6 #define maxn 2000 7 8 int main() 9 { 10 string s; 11 while(cin>>s){ 12 for(int i=0;i<s.length();i++){ 13 if(s[i]>='a'&&s[i]<='z'){ 14 printf("%c",s[i]-32); 15 }else if(s[i]>='A'&&s[i]<='Z'){ 16 printf("%c",s[i]+32); 17 }else{ 18 printf("%c",s[i]); 19 } 20 } 21 printf("\n"); 22 } 23 return 0; 24 }