题解:CF2121B Above the Clouds
题意
给你一个由小写英文字母组成的长度为
思路
明显当
那么我们可以开一个桶
代码
#include<iostream>
using namespace std;
int T,n,t[30];
string s;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin>>T;
while(T--){
bool f=1;
cin>>n>>s;
for(int i=0;i<n;i++) t[s[i]-'a']++;//统计
for(int i=1;i<n-1;i++) if(t[s[i]-'a']>1){cout<<"Yes\n",f=0;break;}
if(f) cout<<"No\n";
for(int i=0;i<30;i++) t[i]=0;//多测不清空,爆零两行泪
}
}