Two players play a simple game with a coin.
Given is a set S. Each element of S is a sequence of heads and tails, and all the sequences have the same length.
The first player starts the game by choosing a sequence from S. Then the second player chooses a different sequence from S.
A fair coin is then thrown repeatedly until one of the chosen sequences appears as a set of consecutive throws.
The player that has chosen this sequence wins.
You are given a String[] sequences containing the allowed sequences encoded as strings of 'H's and 'T's ('H' represents a head, 'T' represents a tail). Return the probability that the first player will win this game, given that both players play optimally.
