• Educational Round 26 A. Text Volume


    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
    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.

     1 /*
     2 scanf输入字符串,整型,实型等数据判断的方式都一样
     3 回车,空格,tab键都认为是一个数据的结束,当然字符的话
     4 一个字符就是结束了,回车,空格等都有对应的ascii码
     5 所以用scanf输入字符时要小心这些东东被当成字符输进去
     6 而输入字符串和整型,实型等数据时这些都被当成分隔符而不会被输入到字符数组或变量里。
     7 for(int i=0;i<10;++i){
     8     char ch=getchar();
     9     fflush(stdin); //每次都会有等待状态了(VC平台)
    10     printf ( "ch=%c
    ", ch );
    11 }
    12 */
    13 #include <iostream>
    14 #include <stdio.h>
    15 
    16 using namespace std;
    17 int mx=0,t=0;
    18 char c;
    19 int main(){
    20     int n;
    21     //ios::sync_with_stdio(false);
    22         scanf("%d",&n);
    23         for(int i=0;i<=n;i++){
    24         c=getchar();
    25          if(c==' '){
    26             mx=max(mx,t);
    27             t=0;
    28          }else {
    29              if (c<='Z'&&c>='A') {
    30                 t++;
    31               }
    32             }
    33         }
    34            mx=max(mx,t);
    35     printf("%d
    ",mx);
    36     return 0;
    37 }
  • 相关阅读:
    iOS UIActivityIndicatorView 的使用(旋转菊花)
    iOS textView的使用总结
    IOS UI -label总结
    cocos2dx常见的46中+22中动作详解
    iOS 第三方框架SDWebImage的简单使用
    iOS 下拉刷新
    OC 字符串操作
    一些iOS常用的第三方库和控件
    标日语法(1)
    面向对象(初级)个人总结 第二部分 封装
  • 原文地址:https://www.cnblogs.com/z-712/p/7307629.html
Copyright © 2020-2023  润新知