各种stl应用
ACcode:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
#define pb(x) q.push_back(x)
vector<string>q;
int main(){
int loop;
scanf("%d",&loop);
string s;
while(loop--){
q.clear();
cin>>s;
int len=s.length();
int tot=0;
string ss=s;
reverse(ss.begin(),ss.end());
pb(s);pb(ss);
for(int i=1;i<len;++i){
string a,b,c,d,t;
a=b=s.substr(0,i);
reverse(b.begin(),b.end());
c=d=s.substr(i,len-1);
reverse(d.begin(),d.end());
pb(a+d);pb(b+c);pb(b+d);
pb(c+a);pb(c+b);pb(d+a);
}
sort(q.begin(),q.end());
vector<string>::iterator it=unique(q.begin(),q.end());
int ans=distance(q.begin(),it);
printf("%d\n",ans);
}
return 0;
}