Problem B

来源:互联网 发布:编程语言薪资排行 编辑:程序博客网 时间:2024/05/18 15:56
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 mixingthe English letter uses, for example "computer science" is writtenfrequently "coMpUtEr scIeNce" by him, this mistakes lets Eddy'sEnglish teacher be extremely discontentment.Now please you to writea procedure to be able in the Bob article English letter to turncompletely the small letter.

Input

The input contains several test cases.each lineconsists a test case,Expressed Eddy writes in an article , byletter, blank space,numeral as well as each kind ofpunctuation
composition, the writing length does not surpass 1000characters.

Output

For each test case, you should output an onlyline, after namely the result of transforms the lowercaseletter.

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;
}
 
原创粉丝点击