Problem D: 零起点学算法106——首字母变大写

Time Limit: 1 Sec  Memory Limit: 64 MB
Submit: 18252  Solved: 5211

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
代码如下:
#include<bits/stdc++.h>
using namespace std; int main(){
char a[101];
while(gets(a)!=NULL){
a[0]=toupper(a[0]);
for(int i=1;i<(int)strlen(a);i++){
if(a[i]==' ') a[i+1]=toupper(a[i+1]);
}
printf("%s\n",a);
} return 0;
}

ZSTUOJ刷题11:Problem D.--零起点学算法106——首字母变大写的更多相关文章

  1. Problem G: 零起点学算法106——首字母变大写

    #include<stdio.h> #include<string.h> int main(void) { ]; int i,k; while(gets(a)!=NULL) { ...

  2. Problem F: 零起点学算法101——统计字母数字等个数

    #include<stdio.h> #include<string.h> int main(){ ]; while(gets(str)!=NULL){ ,b=,c=,d=; ; ...

  3. Problem H: 零起点学算法109——单数变复数

    #include <stdio.h> #include<string.h> int main(void) { int n; ]; scanf("%d",&a ...

  4. Problem D: 零起点学算法95——弓型矩阵

    #include<stdio.h> #include<string.h> int main() { ][]; while(scanf("%d%d",& ...

  5. Problem F: 零起点学算法42——多组测试数据输出II

    #include<stdio.h> int main() { ; while(scanf("%d%d%d",&a,&b,&c)!=EOF) { ...

  6. Problem E: 零起点学算法34——3n+1问题

    #include<stdio.h> #include<math.h> int main() { int n; n<=pow(,); ; scanf("%d&qu ...

  7. Problem K: 零起点学算法107——统计元音

    #include<stdio.h> int main() { int n; ]; while(scanf("%d%*c",&n)!=EOF) { while(n ...

  8. Problem J: 零起点学算法105——C语言合法标识符

    #include<stdio.h> #include<ctype.h>//调用isalpha函数 int main() { int n; ]; while(scanf(&quo ...

  9. Problem I: 零起点学算法104——Yes,I can!

    #include<stdio.h> int main() { ]; while(gets(a)!=NULL) { printf("I am "); printf(&qu ...

  10. Problem H: 零起点学算法103——查找最大元素

    #include<stdio.h> #include<string.h> int main() { ]; while(gets(a)!=NULL) { ]; ;a[i]!='\ ...

随机推荐

  1. Win7+VS2010 环境配置

    最后再次总结一些,Win7下的VS2010总共有三个变量配置: 1. 变量名:path 变量值:D:\Program Files\Microsoft Visual Studio 10.0\VC\bin ...

  2. 如何用python将txt中的package批量安装

    第一步:cd 到目标路径 第二步:新建一个requirement.txt文档,将所有要下载的包一一罗列出来(需要指定版本的话,可以用==表明) 第三步:输入命令  pip install -r req ...

  3. 树莓派zero W ,连接墨水屏(2.13inch_e-Paper_HAT (V3))

    墨水瓶型号:    2.13inch_e-Paper_HAT (V3) https://www.waveshare.net/wiki/2.13inch_e-Paper_HAT 与树莓派 Zero 连接 ...

  4. Linux程序设计

    2.6 shell的语法 2.6.1  变量 参数变量 实验:使用参数和环境变量 #!/bin/sh salutation="Hello" echo $salutation ech ...

  5. groupByKey、reduceByKey、aggregateByKey、foldByKey、combineByKey的联系和区别

    groupByKey根据key对value进行分组,默认没有预聚合 combineByKeyWithClassTag[CompactBuffer[V]]( createCombiner, mergeV ...

  6. python+POM项目设计模式

    分为三层: 第一层:common对selenium进行二次封装,定位元素,操作元素的一些方法,公共方法比如连接数据库.读写yml文件等 第二层:页面封装pages 第三层:测试用例cases

  7. SpringBoot(十五)单个以及多个跨域的配置方法

    同源策略是浏览器的一个安全限制,要求域名.协议.端口相同,如果不同则没办法进行数据交互.而跨域配置,则是为了解除这方面的限制.前后端分离的情况下,因为需要分开部署,后台开发基本都需要进行跨域配置了.( ...

  8. 《Python深度学习》《卷积神经网络的可视化》精读

    对于大多数深度学习模型,模型学到的表示都难以用人类可以理解的方式提取和呈现.但对于卷积神经网络来说,我们可以很容易第提取模型学习到的表示形式,并以此加深对卷积神经网络模型运作原理的理解. 这篇文章的内 ...

  9. Jmeter 实现Json格式接口测试

    接口Request Headers中的Content-Type和和charset 在"HTTP请求"中添加UTF-8 在"HTTP信息头管理器"中添加Conte ...

  10. Assembler Instructions with C Expression Operands

    Using the GNU Compiler Collection For gcc version 4.9.3 (GNU Tools for ARM Embedded Processors) In a ...