版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_39216184/article/details/82794460
把一个字符串中所有出现的大写字母都替换成小写字母,同时把小写字母替换成大写字母。
Input
输入一行:待互换的字符串。
Output
输出一行:完成互换的字符串(字符串长度小于80)。
Sample Input
If so, you already have a Google Account. You can sign in on the right.
Sample Output
iF SO, YOU ALREADY HAVE A gOOGLE aCCOUNT. yOU CAN SIGN IN ON THE RIGHT.
#include<stdio.h>
int main()
{
char s[100];
int i;
gets(s);
for(i=0;s[i];i++)
if(s[i]>='A'&&s[i]<='Z')s[i]+=32;
else if(s[i]>='a'&&s[i]<='z')s[i]-=32;
puts(s);
return 0;
}