#include #include #include #include using namespace std; typedef long long int ll; typedef pair P; #define INF 1000000000 map data; void dfs(string now,string str,int cou); int lim; int main(){ string str; cin >> str; lim = str.size(); string t = ""; dfs(t,str,0); cout << data.size() << endl; } void dfs(string now,string str,int cou){ if(cou == lim) { data[now] = 1; return; } int len = str.size(); string tmp = str; string next = now; tmp.erase(0,1); next += str[0]; dfs(next,tmp,cou+1); tmp = str; next = now; tmp.erase(len-1,1); next += str[len-1]; dfs(next,tmp,cou+1); }