Deck Distribution

View as PDF

Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 977M

Author:
Problem type

James just bought himself a new deck of cards!

James has just counted through the cards and had make sure that there were 52 of them. However, James isn't sure if the deck he has is faulty! He wants to know if all the cards in the deck could make a complete deck, of each of the suits (Spades, Hearts, Clubs, Diamonds) and of each of the values (Ace to King). Could you help James out?

Input

Your first 52 lines each contains a card string of the format "[Ace|2|3|4|5|6|7|8|9|10|Jack|Queen|King] of [Spades|Hearts|Clubs|Diamonds]".

Output

Output "YES" if the deck is complete, and "NO" otherwise.

Example 1

Input
6 of Spades
King of Clubs
4 of Hearts
3 of Clubs
Queen of Diamonds
5 of Clubs
3 of Spades
4 of Clubs
Ace of Spades
9 of Spades
10 of Spades
8 of Spades
7 of Diamonds
5 of Hearts
6 of Clubs
Queen of Clubs
Jack of Diamonds
7 of Spades
Ace of Diamonds
Jack of Spades
2 of Spades
6 of Diamonds
Ace of Hearts
King of Diamonds
10 of Clubs
10 of Hearts
4 of Diamonds
8 of Hearts
5 of Spades
2 of Diamonds
7 of Hearts
3 of Diamonds
9 of Diamonds
9 of Hearts
3 of Hearts
9 of Clubs
Queen of Hearts
10 of Diamonds
2 of Clubs
6 of Hearts
2 of Hearts
Ace of Clubs
Jack of Hearts
King of Hearts
Jack of Clubs
8 of Clubs
Queen of Spades
8 of Diamonds
4 of Spades
King of Spades
7 of Clubs
5 of Diamonds
Output
YES
Explanation

The cards in this deck covers every suit and value, which means this deck is complete.

Example 2

Input
9 of Clubs
10 of Clubs
King of Spades
8 of Spades
6 of Diamonds
Jack of Hearts
4 of Diamonds
7 of Diamonds
3 of Spades
5 of Hearts
10 of Hearts
4 of Diamonds
10 of Hearts
4 of Spades
8 of Spades
5 of Spades
4 of Spades
6 of Spades
Jack of Spades
5 of Diamonds
7 of Hearts
8 of Clubs
8 of Diamonds
Ace of Diamonds
9 of Clubs
5 of Diamonds
7 of Spades
8 of Diamonds
2 of Clubs
5 of Hearts
Queen of Clubs
4 of Spades
Queen of Hearts
6 of Clubs
King of Spades
Queen of Clubs
10 of Hearts
7 of Diamonds
8 of Hearts
Ace of Hearts
8 of Hearts
8 of Diamonds
Jack of Diamonds
4 of Diamonds
4 of Clubs
10 of Spades
Jack of Hearts
4 of Spades
Queen of Diamonds
9 of Diamonds
9 of Clubs
6 of Hearts
Output
NO
Explanation

The 9 of Clubs appears many times in this deck, which means this deck is faulty and incomplete.

Python Template

cards = []
for _ in range(52):
    cards.append(input())

Comments

There are no comments at the moment.