HDU 2026 首字母变大写(字符串处理)
来源:互联网 发布:windows命令ftp放文件 编辑:程序博客网 时间:2024/06/06 05:06
首字母变大写
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 48091 Accepted Submission(s): 26540
Problem Description
输入一个英文句子,将每个单词的第一个字母改成大写字母。
Input
输入数据包含多个测试实例,每个测试实例是一个长度不超过100的英文句子,占一行。
Output
请输出按照要求改写后的英文句子。
Sample Input
i like acmi want to get an accepted
Sample Output
I Like AcmI Want To Get An Accepted
Author
lcy
AC代码:
#include<iostream>#include<cstdlib>#include<cstdio>#include<cmath>#include<cstring>#include<string>#include<cstdlib>#include<iomanip>#include<algorithm>typedef long long LL;using namespace std;int main(){int i;char a[100];while(gets(a)){for(i=0;i<strlen(a);++i){ if(i==0) //对字符串进行加减,直接对应相应字母,a的ascii码为97,A的ascii码为65,差32;a[0]=a[0]-32; if(a[i]==' ')a[i+1]=a[i+1]-32;cout<<a[i];}cout<<endl;}return 0;}
1 0
- HDU 2026 首字母变大写(字符串处理)
- hdoj 2026 首字母变大写 (字符串)
- hdu 2026 首字母变大写(java)
- HDU 2026 首字母变大写(水~)
- hdu 2026 首字母变大写
- HDU 2026 首字母变大写
- Hdu 2026 - 首字母变大写
- HDU 2026 首字母变大写
- HDU 2026 首字母变大写
- hdu-2026-首字母变大写
- HDU 2026 - 首字母变大写
- [hdu 2026] 首字母变大写
- HDU 2026 首字母变大写
- HDU 2026 首字母变大写
- hdu 2026 首字母变大写
- HDU 2026 -- 首字母变大写
- 首字母变大写 HDU 2026
- HDU 2026 首字母变大写
- 高数小知识点(1)
- android常用控件
- JVM 方法区回收小结
- 关于Android零基础学习的思考
- mysql计算同一季度的和
- HDU 2026 首字母变大写(字符串处理)
- Python pip 使用小技巧
- App更新策略课程-实现进度更新
- Median of Two Sorted Arrays
- 06广东省赛(I)BFS
- 实现一个队列类
- 网络编程--Volley之ImageLoader
- imageView显示保存在服务器的图片,不是网页上的图片
- java操作redis