Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## Re:stl

Posted by Yt_zp at 2017-04-10 14:57:43 on Problem 3007
In Reply To:stl Posted by:Yt_zp at 2017-04-10 14:57:38
```#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;
}
```

Followed by: