Affiliate Disclosure: This post contains Amazon affiliate links. If you purchase through these links, eBlogarithm may earn a commission at no extra cost to you. Prices and availability are subject to change.
#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;
}
📦 Looking for Codeforces Round 436 Div Problem Polycarp? Check the best deals on Amazon.
🛒 Shop Codeforces Round 436 Div Problem Polycarp on Amazon
As an Amazon Associate, eBlogarithm earns from qualifying purchases. Prices and availability are subject to change.
Affiliate Disclosure: This post contains Amazon affiliate links. If you purchase through these links, eBlogarithm may earn a commission at no extra cost to you. Prices and availability are subject to change.
#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;
}
📦 Looking for Codeforces Round 436 Div Problem Polycarp? Check the best deals on Amazon.
🛒 Shop Codeforces Round 436 Div Problem Polycarp on Amazon
As an Amazon Associate, eBlogarithm earns from qualifying purchases. Prices and availability are subject to change.