405037: GYM101745 B Alphabetic Subsequence
Description
Davy has a string s consisting of digits '0' to '9'. He wants to replace each digit '0' to '9' with a unique character from 'a' to 'j' in such a way that two equal digits are always replaced with the same character, while two distinct digits are always replaced with distinct characters. Davy is interested in such replacements that there exists a subsequence of the string that is 'abcdefghij'.
Count the number of ways he can do the replacements so that this condition is satisfied. Two replacements are considered to be distinct if there exists a digit that is replaced with distinct characters in these two replacements.
InputThe only line of the input contains a string s consisting of digits from '0' to '9'. The string is non-empty and its length doesn't exceed 100.
OutputPrint out a single integer, the number of ways to do replacement that satisfy all the conditions given in the problem statement.
ExamplesInput0123456789Output
1Input
01234567899876543210Output
512