#include #define rep(i,n) for(int i=0;i<(n);++i) #define all(a) (a).begin(),(a).end() #define dunk(a) cout << (a) << endl using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); string S; cin >> S; int n = S.size(); set st; //left-start -> 0 right-start -> 1 for (int bit = 0; bit < (1 << n - 1); ++bit) { string res = ""; int a = 0; int b = n - 1; for (int i = 0; i < n - 1; ++i) { if (bit & (1 << i)) { res += S[a]; a++; } else { res += S[b]; b--; } } res += S[a]; st.insert(res); } dunk(st.size()); return 0; }