您的位置:首页 > 其它

HDU2026_首字母变大写

2016-11-18 18:18 330 查看


首字母变大写

http://acm.hdu.edu.cn/showproblem.php?pid=2026

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 53641    Accepted Submission(s): 29475


Problem Description

输入一个英文句子,将每个单词的第一个字母改成大写字母。

 

Input

输入数据包含多个测试实例,每个测试实例是一个长度不超过100的英文句子,占一行。

 

Output

请输出按照要求改写后的英文句子。

 

Sample Input

i like acm
i want to get an accepted

 

Sample Output

I Like Acm
I Want To Get An Accepted

 

Author

lcy

 

Source

C语言程序设计练习(四)

#include <stdio.h>
int main()
{
char c;
int i = 0;
while ((c = getchar()) != EOF)
{
if (c == ' ')
{
printf(" ");
i = 0;
continue;
}
if (c == '\n')
{
printf("\n");
i = 0;
continue;
}
if (i == 0)
{
printf("%c", c - 32);
++i;
}
else printf("%c", c);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ACM