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

 1 /*
 2 求连续的小写字母中小写字母的种数
 3 */
 4 #include <bits/stdc++.h>
 5 using namespace std;
 6 const int maxn=200+10;
 7 int main()
 8 {
 9     int n;
10     char str[maxn];
11     map<char,bool> ma;
12     cin>>n;
13     cin>>str;
14     int cnt=0;
15     int maxnn=0;
16     int len=strlen(str);
17     for(int i=0;i<len;i++)
18     {
19         if(str[i]>='a'&&str[i]<='z')
20         {
21             if(ma[str[i]]==0)
22                 cnt++;
23             ma[str[i]]=1;
24         }
25         else
26         {
27             ma.clear();
28             maxnn=max(maxnn,cnt);
29             cnt=0;
30         }
31     }
32     maxnn=max(maxnn,cnt);
33     cout<<maxnn<<endl;
34 }

 

posted @ 2017-09-26 20:28  Kearon  阅读(58)  评论(0编辑  收藏  举报