138 - ZOJ Monthly, January 2015 - B
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
There are multiple test cases. Each test case has only one line, a valid string indicating the cards on the table.
For each test cases, output the remainder of the number of ways modulo by 109+7.
Author: QIAN, Yanliang