import std.algorithm, std.array, std.container, std.range; import std.string, std.conv, std.math; import std.stdio, std.typecons; void main() { auto s = readln.chomp; auto r = iota(1 << (s.length - 1)).map!(i => calc_s(s, i)).array; writeln(calc_h(r)); } string calc_s(string s, int n) { string r = ""; while (s.length > 1) { if ((n & 1) == 0) { r ~= s.front; s = s[1..$]; } else { r ~= s.back; s = s[0..$-1]; } n >>= 1; } return r ~ s; } int calc_h(string[] r) { bool[string] h; foreach (s; r) h[s] = true; return h.length.to!int; }