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. go 的形参

    注意 记录一个 go 语言编程中,可能不小心忽略的一个点, 当函数的 出参 如果是 数组.结构体.字典 类型时,是不需要声明的,可以直接使用. 但是如果 出参 是 指针 类型,则必须要显示的声明. 代 ...

  2. 【运维】解决composer update出现的Discard changes [y,n,v,d,s,?]的问题

    在PHP项目中,composer是一个使用非常普遍的包管理工具,在本地开发的时候出现了这个问题一搬来说问题不大,可以人为进行输入交互,但是如果是自动化发布中出现,就会等待输入导致卡住,是一个需要解决的 ...

  3. py06

    元祖tuple 与列表类似可以存多个值,但是不同的是元祖本身不能被修改 #一:基本使用:tuple# 1 用途:记录多个值,当多个值没有改的需求,此时用元组更合适 # 2 定义方式:在()内用逗号分隔 ...

  4. Outlook怎么合并相同邮件?设置Outlook邮件为对话模式

    选择View->勾选"Show as Conversations", 这样同一个标题的邮件就是叠在一块显示了. 不蟹,bro.

  5. 什么是cache

    什么是cacheTo minimize the quantity of control information stored, the spatial locality property is use ...

  6. 解题报告:Codeforces 279C Ladder

    Codeforces 279C Ladder 本题与tbw这篇博客上的题有相似思路.tbw的本来我还不会,抄了题解才过,这道题好歹自己磕半天磕出来了.到tbw做那道题我突然想明白了,再一想诶跟这里不是 ...

  7. Kato's inequality and subharmonic function

    If $\Delta u=0$ in $\Omega\subset\mathbb{R}^n (n\geq2)$, then  for $p>\frac{n-2}{n-1}$, $|Du|^p$ ...

  8. k8s_使用k8s部署博客系统-PV PVC(二)

    PV和PVC PV(PersistentVolume)在声明的时候需要指定大小和续写模式:["ReadWriteMany","ReadWriteOnce",&q ...

  9. Spring事务注意事项 以及 遇到的坑

    原创参考: https://www.cnblogs.com/yougewe/p/7466677.html   (Spring,为内部方法新起一个事务,此处应有坑.) https://blog.csdn ...

  10. HTML弹窗设计二

    <!DOCTYPE html><html> <head> <title>模态框弹出层.html</title> <meta http- ...