zoukankan      html  css  js  c++  java
  • A. Text Volume

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

    水题一个,直接用getchar然后遇到空格判断一下就成

     1 #include <iostream>
     2 #include <cstdio>
     3 #include <cstring>
     4 using namespace std;
     5 int n,Max=0,p=0;
     6 char c;
     7 string s;
     8 int main() {
     9     scanf("%d",&n);
    10     for(int i=0;i<=n;i++){
    11         c=getchar();
    12         if(c==' '){
    13             Max=max(Max,p);
    14             p=0;
    15         }else{
    16             if(c>='A'&&c<='Z'){
    17                 p++;
    18                // cout<<c<<p<<endl;
    19             }
    20         }
    21     }
    22     Max=max(Max,p);
    23     printf("%d
    ",Max);
    24     return 0;
    25 }
  • 相关阅读:
    float浮动后,父级元素高度塌陷和遮盖问题
    Json
    测试连接数据库是否成功
    spark standalone zookeeper HA部署方式
    用NAN简化Google V8 JS引擎的扩展
    在Android上使用Google V8 JS 引擎
    数据可视化工具zeppelin安装
    kafka0.8.2以下版本删除topic
    kafka迁移数据目录
    scala2.10.x case classes cannot have more than 22 parameters
  • 原文地址:https://www.cnblogs.com/zllwxm123/p/7283561.html
Copyright © 2011-2022 走看看