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.
The 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.
Print out a single integer, the number of ways to do replacement that satisfy all the conditions given in the problem statement.
0123456789
1
01234567899876543210
512
Name |
---|