codeforces-5

这题可害苦了我
最后用了大哥的代码才过的

Diverse String

#include<iostream>
#include<cstdio> #include<string.h> #include<algorithm> using namespace std; int main() { int T; string s; cin>>T; while(T--) { cin>>s; sort(s.begin(),s.end()); bool flag=true; for(int i=1;i<s.size();i++) { if(s[i]!=s[i-1]+1){ puts("NO"); flag=false; break; } } if(flag) puts("Yes"); } return 0; }

猜你喜欢

转载自www.cnblogs.com/WABoom/p/10687011.html