codeforces 837A
来源:互联网 发布:知乎赞同和感谢 编辑:程序博客网 时间:2024/05/17 01:22
time limit per test
1 secondmemory limit per test
256 megabytesinput
standard inputoutput
standard outputYou are given a text of single-space separated words, consisting of small and capital Latin letters.
Volume of the word is number of capital letters in the word. Volume of the text is maximum volume of all words in the text.
Calculate the volume of the given text.
Input
The first line contains one integer number n (1 ≤ n ≤ 200) — length of the text.
The second line contains text of single-space separated words s1, s2, ..., si, consisting only of small and capital Latin letters.
Output
Print one integer number — volume of text.
Examples
input
7
NonZERO
output
5
input
24
this is zero answer text
output
0
input
24
Harbour Space University
output
1
Note
In the first example there is only one word, there are 5 capital letters in it.
In the second example all of the words contain 0 capital letters.
分析:题意简单,主要是解决输入问题。
代码:
#include<bits/stdc++.h>using namespace std;char s[205];int main(){ int n; scanf("%d",&n); getchar(); //gets(s); scanf("%[^\n]", s);//意思是读取到换行结束,但是前面有输入,先用getchar过滤掉换行使用gets也一样要用getchar
//其他方法:while(~scanf("%s",s))一个串的读入进去操作,do while循环也一样,读取到'\n'结束就可以了,还可以用getchar单个字符读入 int num=0,ans=0; for(int i=0;i<n;i++) { if(s[i]==' ') { num=0; continue; } if(s[i]>='A'&&s[i]<='Z') { num++; } ans=max(ans,num); } printf("%d\n",ans);}
阅读全文
0 0
- codeforces 837A
- codeforces 837A Text Volume
- codeforces 837A Text Volume
- Codeforces 837A Text Volume
- CodeForces-a
- Codeforces 903A A
- Educational Codeforces Round 30 837A. Chores
- CodeForces 18A A - Triangle
- CodeForces 133A A. HQ9+
- codeforces 651A A. Joysticks
- 【Codeforces 597A】A. Divisibility
- 【 Codeforces 615A】A. Bulbs
- A. Divisibility CodeForces 597A
- codeforces 417A A. Elimination
- CodeForces 534A A. Exam
- codeforces#98 a
- codeforces#99 a
- codeforces 105 div2 A
- What/How/Why(学习技术三部曲)
- NOIP2016-普及组复赛-第2题-回文日期
- 工作-2017.08.13-周记总结篇(三)
- 安卓文件读写二,对不同文件的处理要点
- 安卓测试和iOS测试的区别
- codeforces 837A
- Unity3D Shader(14)——Fragment Shader(遮挡、透明效果)
- RecyclerView notifyItemInserted(0)没有动画效果
- ZOJ 3228 AC自动机
- LintCode Python 第k大元素
- 循环
- CodeForces
- Git笔记
- 【初等数论】【转载】夜深人静写算法(五)