#include<iostream>
using namespace std;
int main(){
bool big;
int k,cur=0,max=0,conti=0;
string s;
cin>>k>>s;
if(s[0]>=97) big = false;
else big = true;
for(int i=0;i<s.size();i++){
if(s[i]>=97&&big == false) conti++;
else if(s[i]>=97&&big == true){
big = false;
conti = 1;
}
else if(s[i]<97&&big == true) conti++;
else if(s[i]<97&&big == false){
big = true;
conti = 1;
}
if(conti == k){
cur += k;
}else if(conti>k){
cur = k;
conti = k;
}
if(cur>max) max = cur;
}
cout<<max<<endl;
}
#include
using namespace std;
int main(){
bool big;
int k,cur=0,max=0,conti=0;
string s;
cin>>k>>s;
if(s[0]>=97) big = false;
else big = true;
for(int i=0;i<s.size();i++){
if(s[i]>=97&&big == false) conti++;
else if(s[i]>=97&&big == true){
big = false;
conti = 1;
}
else if(s[i]<97&&big == true) conti++;
else if(s[i]<97&&big == false){
big = true;
conti = 1;
}
if(conti == k){
cur += k;
}else if(conti>k){
cur = k;
conti = k;
}
if(cur>max) max = cur;
}
cout<<max<<endl;
}
喔沒事,沒想清楚