题意:给你一串长度为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. Git从库中移除已删除大文件

    写在前面大家一定遇到过在使用Git时,不小心将一个很大的文件添加到库中,即使删除,记录中还是保存了这个文件.以后不管是拷贝,还是push/pull都比较麻烦.今天在上传工程到github上,发现最大只 ...

  2. Convert.ChangeType不能处理Nullable类型的解决办法(转)

    https://www.cnblogs.com/patrickyu/p/3211115.html 在做一个ORMapping功能的时候发现,Convert.ChangeType不能处理nullable ...

  3. Android OkHttp Get请求方式

    1.导入okhttp-2.7.5.jar和okio-1.11.0.jar 2.Get请求 public void getDataByGet(){ OkHttpClient client = new O ...

  4. JRockit Mission Control建立到Tomcat的连接(windows)

    http://www.360doc.com/content/10/0928/16/203871_57086538.shtml  蓝海豹 JRockit Mission Control建立到Tomcat ...

  5. Ubuntu 15.10 下Redis Cluster使用

    1 Redis Standalone安装 可以参考这篇博文:http://www.cnblogs.com/_popc/p/3684835.html 2 Redis Cluster安装 2.1 环境介绍 ...

  6. mvc中让路由忽略带后缀的路径文件

    public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/ ...

  7. Redhat Linux 配置Xmanager

    1. vi /etc/inittab id:5:initdefault:  //设置系统运行级为5,如果本来就是5就无需修改 id:5:respawn:/usr/sbin/gdm    //添加到最后 ...

  8. 记录7: office 2016 Mac不能使用的解决过程

    前几天更新硬盘并升级到high sierra后,今天第一次打开word/excel发现用不了,提示让我进行active.很奇怪,之前的license应该是一直有效的.于是去www.office.com ...

  9. 【转录组入门】6:reads计数

    作业要求: 实现这个功能的软件也很多,还是烦请大家先自己搜索几个教程,入门请统一用htseq-count,对每个样本都会输出一个表达量文件. 需要用脚本合并所有的样本为表达矩阵.参考:生信编程直播第四 ...

  10. SN Writer 写号工具使用

               SN Writer 写号工具的使用 蓝牙写号: 打开SN Writer 写号工具 1.点击System Config按钮 2.进入界面,选择需要写号的类型,及选择相应的写号文件, ...