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
注意:这题我做了好多遍,输出结果总是不对,后来在输入的时候将while(~scanf"%s",st))改成了while(gets(st))才正确。
#include<stdio.h> #include <string.h> int main() { int i; char st[200]; while(
gets(st)) { if(st[0]>='a'&&st[0]<='z') st[0]=st[0]-32; for(i=1;i<strlen(st);i++)
{ if(st[i]==' ') { if(st[i+1]>='a'&&st[0]<='z') { st[i+1]-=32; } } } printf("%s"
,st); printf("\n"); } return 0; }

技术
今日推荐
PPT
阅读数 99
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信