#include #include using namespace std; string s; void construct(int f_idx, int r_idx, string str, set& works) { if (f_idx > r_idx) { works.insert(str); return; } construct(f_idx + 1, r_idx, str + s[f_idx], works); construct(f_idx, r_idx - 1, str + s[r_idx], works); } int main() { cin >> s; set works; construct(0, s.size() - 1, "", works); cout << works.size() << endl; return 0; }