https://i0.wp.com/eblogarithm.com/wp-content/uploads/2017/09/Codeforces-Round-436-Div-2-problem-B-Polycarp-and-Letters-Solution-In-CC1.png?fit=640%2C360

Codeforces Round #436 (Div. 2), problem: (B) Polycarp and Letters Solution In C/C++

#include <stdio.h>

int c[26];

void reset(){
for(int i=0;i<26;i++){
c[i]=0;
}
}

int main(){
int n,i,cur=0,max=0;
scanf(“%d”,&n);
char a[n+1];
scanf(“%s”,a);

reset();
for(i=0;i<n;i++){
if(a[i]>=’A’ && a[i]<=’Z’){
cur=0;
reset();
}
else if(c[a[i]-‘a’]==0){
c[a[i]-‘a’]++;
cur++;
}
if(cur>max){
max=cur;
}
}
printf(“%d\n”,max);
return 0;
}

(Visited 59 times, 1 visits today)



There are no comments

Add yours

Leave a Reply

%d bloggers like this: