fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define GG ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  4. int main () { GG;
  5. int t; cin>>t;
  6. while(t--) {
  7. int n; string s,t;
  8. cin>>n>>s; t=s;
  9. set<string> ss;
  10. for(int i=0;i<n-1;i++)
  11. { s=t;
  12. s.erase(i,2);
  13. ss.insert(s);
  14. }
  15.  
  16. cout<<ss.size()<<"\n";
  17. }return 0;}
Success #stdin #stdout 0.01s 5268KB
stdin
7
6
aaabcc
10
aaaaaaaaaa
6
abcdef
7
abacaba
6
cccfff
4
abba
5
ababa
stdout
4
1
5
3
3
3
1