CodeForces 864B Polycarp and Letters
来源:互联网 发布:硬盘录像机端口 编辑:程序博客网 时间:2024/06/05 17:42
题目链接:http://codeforces.com/contest/864/problem/B
题意:给你一串长度为n的字符串(由大小写字母组成),现在这个人只喜欢小写字母,现在让你求一段最长的连续子串(全由小写字母组成,并且夹在大写字母之间)长度
解析:从第一个大写字母开始,到第二个就更新答案,一直这样做下去
#include <bits/stdc++.h>using namespace std;set<char>a;int main(void){ int n,ans = 0; string s; cin>>n>>s; for(int i=0;i<n;i++) { if(s[i]>='A' && s[i]<='Z') { ans = max(ans,(int)a.size()); a.clear(); } else a.insert(s[i]); } ans = max(ans,(int)a.size()); printf("%d\n",ans); return 0;}
阅读全文
0 0
- CodeForces 864B Polycarp and Letters
- codeforces 864B 之 Polycarp and Letters
- B. Polycarp and Letters
- B. Polycarp and Letters
- Codeforces Round #436 (Div. 2) B. Polycarp and Letters
- Polycarp and Letters
- Codeforces Round #436 (Div. 2) A.Fair Game B.Polycarp and Letters C. Bus D.Make a Permutation!
- Codeforces Anton and Letters
- Codeforces 659F Polycarp and Hay【BFS】
- 【17.69%】【codeforces 659F】Polycarp and Hay
- Codeforces 443A Anton and Letters(水题)
- CodeForces 443A Anton and Letters
- CodeForces 443A Anton and Letters
- Codeforces 659F Polycarp and Hay (排序+并查集)
- Codeforces Round #253 (Div. 2)A. Anton and Letters
- Codeforces Round #253 (Div. 2) A. Anton and Letters
- codeforces——443A——Anton and Letters
- Codeforces Round #346 (Div. 2) F. Polycarp and Hay(并查集)
- 数据结构与C语言实现(二)——堆栈和队列
- JPEG解码程序(带中文注释)
- Git配置用户名密码
- 关于VirtualBox记录
- Eclipse怎么汉化?
- CodeForces 864B Polycarp and Letters
- Linux Unit2--Linux系统结构
- vs无法打开文件“glut32“解决方案
- BZOJ 3712 Fiolki (倍增LCA)
- ZUFE 2485
- bzoj1977(未写完题解)
- js实现多选框的全选/全不选
- 关于创业公司和技术Leader的一些感想
- git设置用户名密码