#K63522. Card Game Winner

    ID: 31772 Type: Default 1000ms 256MiB

Card Game Winner

Card Game Winner

You are given two hands of cards, each represented as a series of card codes. Each card code consists of a rank and a suit. The rank can be one of the following: 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A, and the suit can be one of: H, D, S, or C. The value of each card is determined by its rank as follows:

\(2=2,\ 3=3,\ \dots,\ 10=10,\ J=11,\ Q=12,\ K=13,\ A=14\)

The total value of a hand is the sum of the individual card values. Your task is to compare the total values of the two hands and determine the winner. If the first hand has a higher total value, the output should be "Player 1 wins"; if the second hand has a higher total value, the output should be "Player 2 wins"; if both hands have the same total value, output "Tie".

inputFormat

The input consists of two lines read from standard input (stdin):

  • The first line contains 5 space-separated card codes representing Player 1's hand.
  • The second line contains 5 space-separated card codes representing Player 2's hand.

Each card code is in the format of a rank followed immediately by a suit (e.g. "10H", "KD", "AS").

outputFormat

The output, written to standard output (stdout), is a single line that is one of the following:

  • "Player 1 wins" if the total value of Player 1's hand is greater than that of Player 2.
  • "Player 2 wins" if the total value of Player 2's hand is greater than that of Player 1.
  • "Tie" if both hands have the same total value.

The card values are assigned as follows: \(2=2,\ 3=3,\ \dots,\ 10=10,\ J=11,\ Q=12,\ K=13,\ A=14\).

## sample
2H 3D 5S 9C KD
2C 3H 4S 8C AH
Player 1 wins