The Grand Tournament
题号:NC225342
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Texas Hold'em is one of the most popular variants of the poker game. And Toilet-Ares is in a tournament of Texas Hold'em. Please read the following rules carefully as they may be different from the regular rules.

Two cards, known as hole cards, are dealt face-down to each player. Each player knows his own hole cards. And then five community cards are dealt face-up. All players know the face-up cards that are dealt. All cards are drawn from a standard 52-card deck. A standard 52-card deck comprises 13 ranks in each of the four French suits: clubs (C), diamonds (D), hearts (H), and spades (S). Each suit includes an Ace (A), a King (K), a Queen (Q), and a Jack (J), each of which is depicted alongside a symbol of its suit; and numerals or pip cards from Deuce (Two) to Ten, depicting many symbols (pips) of their suits.

Individual cards are ranked from high to low as follows: A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2. Each player seeks the best five-card poker hand from any combination of the seven cards --- the five community cards and his two hole cards.

The following table shows the possible five-card poker hand types in  order of their values. Each type has a specific ordering of the five cards described below.

Simplest value of cards. The cards are ordered as a_1a_2a_3a_4a_5 such that . (a_i represents the rank of i-th card, the same below)
Two cards with the same rank. The cards are ordered as a_1a_2a_3a_4a_5 such that , , , , .
Two different pairs instead of one. The cards are ordered as a_1a_2a_3a_4a_5 such that , , , , .
Three cards with the same rank. The cards are ordered as a_1a_2a_3a_4a_5 such that , , , .
Five cards in consecutive decreasing rank, not of the same suit. The cards are ordered as a_1a_2a_3a_4a_5 such that a_i is exactly one rank above for all . Note that if a_5 is Ace, a_4 can be 2. In this particular case, Ace is considered one rank below 2.
Five cards of the same suit, not in consecutive decreasing rank. The cards are ordered as a_1a_2a_3a_4a_5 such that .
Combination of Three of a Kind and One Pair. The cards are ordered as a_1a_2a_3a_4a_5 such that , .
Four cards of the same rank. The cards are ordered as a_1a_2a_3a_4a_5 such that .
 Straight of the same suit. The cards are ordered as a_1a_2a_3a_4a_5 such that a_i is exactly one rank above for all . Note that if a_5 is Ace, a_4 can be 2. In this particular case, Ace is considered one rank below 2.
 Straight Flush from Ten to Ace. The cards are ordered as a_1a_2a_3a_4a_5 such that a_1, a_2, a_3, a_4, a_5 are Ace, King, Queen, Jack, Ten of the same suit.

To compare two hands, first, we compare the type of two hands. For example, one hand is Four of a Kind, the other hand is Full House, Four of a Kind always win Full House.

If the types of two hands are the same, we compare the ranks of the cards. We will order the card as described above and compare them one by one. Firstly, we will compare the first card. If a hand's first card has a higher rank, it wins. If the first cards of the two hands have the same rank, we will compare the second card, and so on. If the cards have the same rank in every position, no one wins. The suit of cards never matters. For example, can win . Since they are both Full House, and we will compare the ranks of the three cards of a kind at first.

Consider the case that the hole cards of Alice are and the hole cards of Bob are . The community cards are . The best hand of Alice (five cards among her hole cards and the community hards) is , which is Two Pairs. The best hand of Bob is , which is Straight. Thus, Bob wins.

Toilet-Ares, as a tournament participant, is facing an extremely large pot now. There are five more opponents on the table. The only thing he knows is his hole cards and the five community cards. Assuming his opponents' hole cards are uniformly distributed among the remaining cards at random, Toilet-Ares hopes to know the possibility of winning the pot.

输入描述:

The first line contains two strings representing Toilet-Ares's hole cards.

The second line contains five strings representing the community cards.

For each card, the first character of its corresponding string denotes its rank. Possible ranks are to , , , , , and , where denotes 10. The second character denotes its suit: is club, is diamond, is heart, and is spade.

It is guaranteed that each card appears at most once.

输出描述:

Print a simple fraction in a single line, representing the answer. If numerator is 0, please print "0/1".
示例1

输入

复制
DA HA
SA CA H2 D3 C4

输出

复制
1/1
示例2

输入

复制
DA HK
SA CA H2 S3 S4

输出

复制
81309405029/334969665030
示例3

输入

复制
D2 H2
SA CA HA DA S4

输出

复制
0/1