fb pixel

A deck of cards

In a small deck of cards, there are 36 cards. Each card has a suit:
♦️ Diamonds
♣️ Clubs
❤️ Hearts
♠️ Spades
Let’s play a game.
I mix the deck for you and you start opening the cards one by one. If two consecutive cards have the same suit, you lose, if you manage to reach the end of the deck you win.
The program input contains 36 cards. Each one first has its suit (D for diamonds, C for clubs, H for hearts, S for spades), followed by a number (6, 7, 8, 9, 10) or another letter (A, K, Q, J).
The program should print Victory if you’ll win and Loss otherwise.
HQ CQ HA SJ H10 C9 CK CA HK CJ S10 H7 DJ C6 D9 D7 H8 DQ H9 S6 C7 HJ SK C8 D8 SA DK SQ H6 S8 C10 D10 S7 S9 D6 DA
To check your solution you need to sign in
Sign in to continue