시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB0000.000%

문제

Checks have amount written in words and in numbers. A difference in both amounts makes the check invalid. However, it is often hard to compare both visually. A bank is using scanning and character recognition to read the English text on the check and wants your help in comparing it with the amount. 

The maximum amount to consider is “nine hundred ninety nine trillion nine hundred ninety nine billion nine hundred ninety nine million nine hundred ninety nine thousand nine hundred ninety nine rupees and ninety nine paisas only” and the minimum is “one rupees only”. All input will be in lowercase. Each amount should end with “only”. The word “hundred” is always used when possible e.g. “nine hundred ninety nine” will never be written as “nine ninety nine”. Similarly the word “thousand “ will always be used when possible e.g. “seventy five hundred thirty five” will be written as “seven thousand five hundred thirty five”. The word “rupees” is required but word “paisas” is only necessary when there is a decimal component. The following is an exhaustive list of words that your program must account for:

one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, thirty, forty, fifty, sixty, seventy, eighty, ninety, hundred, thousand, million, billion, trillion, rupees, paisas, and

입력

The input consists of multiple test cases. The first line of input is the number of test cases N(1≤N≤100). Each of the following N lines contains a number with two decimal digits followed by a string of up to 500 characters.

출력

For each test case, print a single line that saying “Case #n:” where n is the test case number followed by a space followed by either “Match” if the string and the number match, “No Match” if they don’t match or “Bad” if the string is not well formatted for that test case. 

예제 입력 1

4
200000.00 two hundred thousand rupees only
1575.00 hundred seventy five rupees only
1070.70 one thousand seventy rupees and seventy paisas only
1600.70 one thousand six hundred rupees only

예제 출력 1

Case #1: Match
Case #2: Bad
Case #3: Match
Case #4: No Match