J.Three Cards
Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 17 Accepted Submission(s) : 8
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
Problem Description
LaoPei and A q are good friends with Debugcool and they like playing cards.There is a way to play cards called Three cards, it is to say, all of the players will get three cards and only one will be the winner.
As everyone knows, each card has one of four suits and one of thirteen values:
suits:clubs( C ),diamonds( D ),hearts( H )and spades( S ). They have no order.
values:2 < 3 < 4 < …… < 9 < T( 10 ) < J < Q < K < A .
And there will be seven types of the three cards on the players' hands:
1) BaoZi:the three cards have the same values, for example:AH AS AD, 2C 2D 2S
2) TongHuaShun:the three cards have the same suit and their values increase by one, for example:7C 8C 9C, JH QH KH
3) JinHua:the three cards have the same suit
4) ShunZi:the three cards' values increase by one
5) DuiZi:there are two cards in the three cards have the same values
6) Other:the other situation except the above
The order:Baozi > TongHuaShun > JinHua > ShunZi > DuiZi > Other, if the players' cards have the same type, the values will be taken into count:on one hand, if the same type is DuiZi, the value of the two cards who have the same value will be compared firstly, if they have the same value, the other card's value will be compared. On the other hand, if the type is not DuiZi, from the biggest to the smallest will be compared successively, eg. QC 10C 9C < KC 4C 3C. If all value of the three cards of the players are the same, they tied. eg. QC 10C 9C = QH 10H 9H.
As everyone knows, each card has one of four suits and one of thirteen values:
suits:clubs( C ),diamonds( D ),hearts( H )and spades( S ). They have no order.
values:2 < 3 < 4 < …… < 9 < T( 10 ) < J < Q < K < A .
And there will be seven types of the three cards on the players' hands:
1) BaoZi:the three cards have the same values, for example:AH AS AD, 2C 2D 2S
2) TongHuaShun:the three cards have the same suit and their values increase by one, for example:7C 8C 9C, JH QH KH
3) JinHua:the three cards have the same suit
4) ShunZi:the three cards' values increase by one
5) DuiZi:there are two cards in the three cards have the same values
6) Other:the other situation except the above
The order:Baozi > TongHuaShun > JinHua > ShunZi > DuiZi > Other, if the players' cards have the same type, the values will be taken into count:on one hand, if the same type is DuiZi, the value of the two cards who have the same value will be compared firstly, if they have the same value, the other card's value will be compared. On the other hand, if the type is not DuiZi, from the biggest to the smallest will be compared successively, eg. QC 10C 9C < KC 4C 3C. If all value of the three cards of the players are the same, they tied. eg. QC 10C 9C = QH 10H 9H.
Input
The input contains several test cases, each test case will have only one line to represent the cards in LaoPei's hand and A q's hand, every line will have six cards, three for LaoPei and three for A q. Each card will consist of two parts:the values and the suits. For example:AS mean spades with value A. The cards will be separated by a space.
Output
For each test case, output a line containing the result of the game. If LaoPei's cards is bigger than A q's, output "LaoPei wins!", if A q's cards is bigger than LaoPei's, output "A q wins!", if they tied, output "Oh my god, who wins, Debugcool knows!"
Sample Input
AC AD AH KC KD KH TD QD JD QC KC JC 2D 2C 5S 2S 2H 5C
Sample Output
LaoPei wins! A q wins! Oh my god, who wins, Debugcool knows!
Author
Source
Developing School's Contest 6