zoukankan      html  css  js  c++  java
  • 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 }
  • 相关阅读:
    php生成二维码遇到的问题
    ua判断页面在什么终端/系统打开
    js实现复制文字到剪切板
    jquery 实现表单数据转化为对象格式
    [转]关于setTimeout()你所不知道的地方
    关于性能优化
    关于event loop
    JS数据结构与算法--双向链表
    JS数据结构与算法--单向链表
    JS数组去重
  • 原文地址:https://www.cnblogs.com/z-712/p/7307629.html
Copyright © 2011-2022 走看看