#include #include #include #include #include using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int len = 0; set se; string S,Temp_S; cin >> S; len = S.length(); vector v(len, 0), temp(len,0); se.insert(S); for (int i = 1; i < len;i++) { v[len - i] = 1; temp = v; int first = 0, last = len - 1; do { for (auto x : temp) { if (x == 0) { Temp_S += S[first]; first++; } else { Temp_S += S[last]; last--; } } se.insert(Temp_S); first = 0; last = len - 1; Temp_S.clear(); } while (next_permutation(temp.begin(),temp.end())); } cout << se.size() << endl; return 0; }