题意:给你一串长度为n的字符,由大小写字母组成,求连续的小写子串中不同字母个数的最大值。

Input
11
aaaaBaabAbA
Output
2
Input
12
zACaAbbaazzC
Output
3
Input
3
ABC
Output
0

思路:水题,瞎搞搞就OK。

代码:
#include<iostream>
#include<string.h>
#include<cmath>
using namespace std; char s[250];
int vis[30]; int main(){
    int l,sum=0,k=0;
    cin>>l>>s;
    if(l==1){
        if(s[0]>='a'&&s[0]<='z')cout<<1<<endl;
        else cout<<0<<endl;
        return 0;
    }
    for(int i=0;i<l;i++){
        if(s[i]>='A'&&s[i]<='Z'){
            memset(vis,0,sizeof(vis));
            k=0;
        }
        else {
            if(vis[s[i]-'a']==0){
                vis[s[i]-'a']=1;
                k++;
                sum=max(sum,k);
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}

Codeforces Round #436 B. Polycarp and Letters的更多相关文章

  1. Codeforces Round #436 (Div. 2)【A、B、C、D、E】

    Codeforces Round #436 (Div. 2) 敲出一身冷汗...感觉自己宛如智障:( codeforces 864 A. Fair Game[水] 题意:已知n为偶数,有n张卡片,每张 ...

  2. Codeforces Round #436 (Div. 2) A,B,D

    A. Fair Game 题目链接:http://codeforces.com/contest/864/problem/A 水题 #include<iostream> #include&l ...

  3. Codeforces Round #436 (Div. 2) 题解864A 864B 864C 864D 864E 864F

    A. Fair Game time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  4. Codeforces Round #436 (Div. 2) B. Polycarp and Letters

    http://codeforces.com/contest/864/problem/B 题意: 给出一个字符串,要求找到一个集合S,使得从S中选出的所有数,在这些数的位置上的字母全部为小写且是不同的字 ...

  5. Codeforces Round #436 (Div. 2) C. Bus

    http://codeforces.com/contest/864/problem/C 题意: 坐标轴上有x = 0和 x = a两点,汽车从0到a之后掉头返回,从a到0之后又掉头驶向a...从0到a ...

  6. Codeforces Round #436 (Div. 2) E. Fire

    http://codeforces.com/contest/864/problem/E 题意: 有一堆物品,每个物品有3个属性,需要的时间,失效的时间(一开始)和价值.只能一件一件的选择物品(即在选择 ...

  7. Codeforces Round #436 (Div. 2)

    http://codeforces.com/contest/864 第一次打cf的月赛-- A 题意:给你一个数列,问你能不能保证里面只有两种数且个数相等.2<=n<=100,1<= ...

  8. Codeforces Round #436 (Div. 2) D. Make a Permutation!

    http://codeforces.com/contest/864/problem/D 题意: 给出n和n个数(ai <= n),要求改变其中某些数,使得这n个数为1到n的一个排列,首先保证修改 ...

  9. Codeforces Round #436 (Div. 2)D. Make a Permutation! 模拟

    D. Make a Permutation! time limit per test: 2 seconds memory limit per test: 256 megabytes input: st ...

随机推荐

  1. day02python基本数据类型

    python基本数据类型   基本数据类型(int,bool,str) 1.基本数据数据类型: int 整数 str 字符串. 一般不存放大量的数据 bool 布尔值. 用来判断. True, Fal ...

  2. .net 超长URL请求返回404错误-解决方法

    <system.webServer> <security> <requestFiltering> <requestLimits maxQueryString= ...

  3. JAVA\Android 多线程实现方式及并发与同步

    转载:https://blog.csdn.net/csdn_aiyang/article/details/65442540 概述     说到线程,就不得不先说线程和进程的关系,这里先简单解释一下,进 ...

  4. qnx gpio

    in order to set gpio in qnx, you can use msmgpiotool # msmgpiotool gpiotool usage: gpiotool <comm ...

  5. Best Practices and Recommendations for RAC databases with SGA size over 100GB (文档 ID 1619155.1)

    Best Practices and Recommendations for RAC databases with SGA size over 100GB (文档 ID 1619155.1) APPL ...

  6. 前端使用crypto.js进行加密

    前端使用crypto.js进行加密 https://www.cnblogs.com/lz2017/p/8046816.html   最近我在前端使用Cookies保存密码的时候需要前端来进行加密工作, ...

  7. ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry ’1′ for key ‘PRIMARY’

    在打开navicat设计表时,想更改主键id为自动增长,会弹出来这么一个提示.翻译为:更改表将导致自动增长(列)的重新排序,主键会有重复的‘1’.原因是因为auto_increment是从1开始自增的 ...

  8. KeyPress和KeyDown/KeyUp

    (1) KeyPress 和KeyDown .KeyUp之间的区别:    1).KeyPress主要用来捕获数字(注意:包括Shift+数字的符号).字母(注意:包括大小写).小键盘等除了F1-12 ...

  9. python,运算符,基本数据类型

    a = 'py' in 'python' b = 'py' not in 'python' print(a)print(b) in :判断一个前面一个字符串中的字符是否完整的出现在后面的字符串中,如果 ...

  10. 在局域网中搭建自己的gis服务器

    在局域网中搭建自己的gis服务器 需求        在客户的B/S应用系统中使用电子地图.该系统只可运行于内部网中. 分析        由于系统中的电子地图只能运行于局域网中所以不能采用googl ...