import std.stdio; import std.string; import std.algorithm; import std.array; import std.conv; void main() { auto line = readln().chomp.to!(dchar[]); auto allLen = line.length; uint[] nums = line.dup.sort!"a < b".group!"a == b".map!"a[1]".array; writeln(allLen.fact() / nums.map!(a => fact(a)).reduce!"a * b" - 1); } ulong fact(ulong n) in { assert(n >= 0); } body { ulong ret = 1; for (ulong i = n; i > 1; --i) { ret *= i; } return ret; }