Problem B
Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 104 Accepted Submission(s) : 31
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
Problem Description
Eddy usually writes articles ,but he likes mixing the English letter uses, for example "computer science" is written frequently "coMpUtEr scIeNce" by him, this mistakes lets Eddy's English teacher be extremely discontentment.Now please you to write a procedure to be able in the Bob article English letter to turn completely the small letter.
Input
The input contains several test cases.each line consists a test case,Expressed Eddy writes in an article , by letter, blank space,numeral as well as each kind of punctuation
composition, the writing length does not surpass 1000 characters.
composition, the writing length does not surpass 1000 characters.
Output
For each test case, you should output an only line, after namely the result of transforms the lowercase letter.
Sample Input
weLcOmE tO HDOj Acm 2005!
Sample Output
welcome to hdoj acm 2005!
思路:直接 大小写转化
ps:在控制输入时注意对于输入结束情况的判断
#include<stdio.h>
#include<string.h>
int main()
{
char s[1001];
int len,i;
//freopen("1.txt","r",stdin);
while(1)
{
s[0]='\0'; //在每次输入之前 清空s 数组 则若下次 gets(s)没有得到输入
gets(s); // 则 len=0 判断输入结束
len=strlen(s);
if(len==0)break;
for(i=0;i<len;i++)
{
if(s[i]>='A'&&s[i]<='Z')
s[i]=s[i]-'A'+'a';
}
printf("%s\n",s);
}
return 0;
}