405037: GYM101745 B Alphabetic Subsequence

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Alphabetic Subsequencetime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard output

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.

Input

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.

Output

Print out a single integer, the number of ways to do replacement that satisfy all the conditions given in the problem statement.

ExamplesInput
0123456789
Output
1
Input
01234567899876543210
Output
512

加入题单

算法标签: