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 }
  • 相关阅读:
    加密,解密Web.Config
    Asp.Net在SqlServer中的图片存取技术
    获得定长字符串
    Response.redirect到一个新页面时,保证不是缓存的方法
    从MapX到MapXtreme2004[12]SearchNearest!
    电子签名实现的思路、困难及解决方案
    LegacyText的复制的Bug
    从MapX到MapXtreme2004[11]坐标概论
    水晶报表的导出和打印
    水晶报表文本在web中无法两端对齐
  • 原文地址:https://www.cnblogs.com/z-712/p/7307629.html
Copyright © 2011-2022 走看看