codeforces 864B - Polycarp and Letters
2017-09-29 21:45
288 查看
http://codeforces.com/problemset/problem/864/B
询问给出的字符串中,两个大写字母之间小写字母不同最多有多少个,模拟。
询问给出的字符串中,两个大写字母之间小写字母不同最多有多少个,模拟。
#include<bits/stdc++.h> using namespace std; int main(){ int n; char a[1111]; while(cin>>n) { cin>>a; int za=0; int letter[26]={0}; int i; int ans=0; for(i=0;i<strlen(a);i++) { if(a[i]>='a'&&a[i]<='z') { if(letter[a[i]-'a']==1)continue; za++; letter[a[i]-'a']=1; } else { ans=max(za,ans); za=0; memset(letter,0,sizeof(letter)); } } ans=max(ans,za); cout<<ans<<endl; } return 0; }
相关文章推荐
- codeforces 864B 之 Polycarp and Letters
- codeforces 864B - Polycarp and Letters
- [Codeforces] #436 B. Polycarp and Letters
- 【codeforces 723 C】【暴力】C. Polycarp at the Radio【1~m中最少的数尽量多】
- 【23.48%】【codeforces 723C】Polycarp at the Radio
- codeforces723C- Polycarp at the Radio-greedy
- Codeforces 861 D Polycarp's phone book(字典树模板)
- codeforces 659F F. Polycarp and Hay(并查集+bfs)
- 【Codeforces 723C】Polycarp at the Radio 贪心
- CodeForces 858C Did you mean... 、 CodeForces 858D Polycarp's phone book!黑科技
- codeforces 858D Polycarp's phone book(字典树)
- Polycarp and Letters
- CodeForces 858D Polycarp's phone book(Trie)
- CodeForces 723C-Polycarp at the Radio(模拟 贪心 vector乱搞)
- Codeforces 659F F - Polycarp and Hay
- Codeforces 861 D. Polycarp's phone book (trie)
- CodeForces 723C Polycarp at the Radio (贪心+暴力)
- B. Polycarp and Letters
- CodeForces 723C Polycarp at the Radio (题意题+暴力)
- CodeForces-1006B-Polycarp's Practice