1997: Simple Problem I
Result | TIME Limit | MEMORY Limit | Run Times | AC Times | JUDGE |
---|---|---|---|---|---|
1s | 10240K | 2002 | 699 | Standard |
I have just typed an article, but I didn't notice that my keyboard's Caps Lock was on. So the article's letter is capital-small-oppsite. Can you help me correct the article?
Input
The input file contains the article I have just typed. And it is terminated by the EOF.Output
Print the corrected article that the captial letters have changed to small letters and small letters have changed to captial letters.Sample Input
hAPPY bIRTHDAY!
Sample Output
Happy Birthday!
#include<iostream>
#include<cstring>
using namespace std;
char s[1000];
int main()
{
cout.flush();
while(gets(s)!=NULL)
{
int i;
int len=strlen(s);
for(i=0;i<len;i++)
{
if(s[i]>='a'&&s[i]<='z')
{
s[i]=s[i]-32;
}
else if(s[i]>='A'&&s[i]<='Z')
{
s[i]=s[i]+32;
}
}
for(i=0;i<len;i++)
{
cout<<s[i];
}
cout<<endl;
}
return 0;
}
#include<cstring>
using namespace std;
char s[1000];
int main()
{
cout.flush();
while(gets(s)!=NULL)
{
int i;
int len=strlen(s);
for(i=0;i<len;i++)
{
if(s[i]>='a'&&s[i]<='z')
{
s[i]=s[i]-32;
}
else if(s[i]>='A'&&s[i]<='Z')
{
s[i]=s[i]+32;
}
}
for(i=0;i<len;i++)
{
cout<<s[i];
}
cout<<endl;
}
return 0;
}