import std.stdio, std.algorithm, std.string, std.conv, std.array, std.typecons, std.range, std.datetime; void main(){ string s; readf("%s\n", &s); auto res = dfs(s).sort.uniq.array.length; res.writeln; } string[] dfs(const string s, string[] acc = [""]){ if(s.length == 0){ return acc; } auto front = dfs( s[1..$], acc.map!(e => e ~ s[0]).array ); auto back = dfs( s[0..$-1], acc.map!(e => e ~ s[$-1]).array ); return front ~ back; }