Educational Codeforces Round 26;A. Text Volume

来源:互联网 发布:工资考勤软件 验厂 编辑:程序博客网 时间:2024/06/08 08:06

题目:                                             A. Text Volume

You 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
7NonZERO
Output
5
Input
24this is zero answer text
Output
0
Input
24Harbour 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.

题意:求给定文本的容量。每个文本的容量为各个单词容量的最大值,每个单词的容量为单词中大写字母的个数


CODE:

#include<bits/stdc++.h>using namespace std;int main(){        int n,i,cnt;        char ch;        while(~scanf("%d%*c",&n)){                int maxr=-1;                cnt=0;                for(i=0;i<n;i++){                        scanf("%c",&ch);                        if(ch==' '){                                maxr=max(maxr,cnt);                                cnt=0;                        }                        else if(ch>='A'&&ch<='Z') cnt++;                }                getchar();                maxr=max(maxr,cnt);                printf("%d\n",maxr);        }        return 0;}


原创粉丝点击