Text Volume
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
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
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 <iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
char s[200];
int a,b=0,h[200]={0};
scanf("%d",&a);
getchar();
gets(s);
for(int i=0;i<a;i++)
{
if(s[i]>='A'&&s[i]<='Z')
h[b]++;
if(s[i]==' ')
{
b++;
}
}
sort(h,h+b+1);
printf("%d\n",h[b]);
return 0;
}