F.R.I.E.N.D.S
Practice
3.3 (3 votes)
Very Easy
Problem
87% Success 369 Attempts 10 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Mishra, Powale , Ashu and Pk are 4 very genious card players in BH I.

In playing cards there are 4 suits having 13 cards each Ace(A), King(K), Queen(Q), Jack(J), 10, 9, 8, 7, 6, 5, 4, 3 and 2, where A,K,Q,J are face cards.

The four suits are Clubs(C), Spades(S), Hearts(H), Diamonds(D).

Everyone is very superstitious about the kind of card they receive after shuffling. So Coordinator Ashu Sir decided to make a rule that the game will be discontinued i.e. a player can throw the cards if he receives maximum of one face card.

Given the final shuffled stack of card, print "-1" if no one can throw the card or the name of the player who can throw the card. If more than 1 player can throw the cards then print the one whose name is lexicographically smallest.

It is given that the distribution is always done as follows : Ashu first, Mishra next, Powale next, Pk next, Ashu next.....and so on.

Input :

52 lines containing 2 strings separated by space each. First string denotes the suit C,S,H or D. Second string denotes the cards A,K,Q,J,10,9,8,7,6,5,4,3 or 2.

Output :

Name of the player throwing card(Lexicographically smallest if more than 1) or "-1".

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:10
1 votes
Tags:
Very-Easy
Points:10
16 votes
Tags:
Very-EasyVery Easy
Points:10
11 votes
Tags:
Basic MathAlgorithmsMath
Editorial

No editorial available for this problem.