Welcome to ZOJ
Information
Problems
Runs
Statistics
Ranklist
Clarification
138 - ZOJ Monthly, January 2015 - B
Cards

Time Limit: 2 Seconds      Memory Limit: 65536 KB

EdwardGy has a poker (52 cards excluding jokers). One day, he saw some cards was lined up on the table. He wanted to know how many ways he can place all of the rest cards in a row with a lower lexicographic order than the line of the cards which were already on the table.

The lexicographic order of the cards is A < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < J < Q < K, and the colors should be ignored. If the cards already on the table is

AA22334455667788991010JJKKK

EdwardGy have only five ways:

AA22334455667788991010JJQQQQK
AA22334455667788991010JJQQQKQ
AA22334455667788991010JJQQKQQ
AA22334455667788991010JJQKQQQ
AA22334455667788991010JJKQQQQ

Input

There are multiple test cases. Each test case has only one line, a valid string indicating the cards on the table.

Output

For each test cases, output the remainder of the number of ways modulo by 109+7.

Sample Input

AA22334455667788991010JJKKK

Sample output

5

Author: QIAN, Yanliang
Submit    Status