1036. A Coin Tossing Game

时间限制 1000 ms   内存限制 32 MB

Cirno and Marisa are playing a coin tossing game. Each time Cirno given a sequence of head(H) and tail(T) with the length of n. Then Marisa needs to give another sequence of n continuous speculation. Then, they begin to toss the coin until the last n times of tossing matches one of their speculations. The one who gives the right guess wins the game.

By now, Cirno has lost the game a lot of times. He wants to know the probability of winning the game.

输入数据

There are multiple test cases. Each test case has one line with two strings made up with characters 'H' and 'T' separated by a blank. The length of each string is n. (n<=27)

The first string stands for Cirno's prediction.

输出数据

Print the winning rate of Cirno in irreducible fraction in one line.

样例输入

复制
H T
HT TH
HH TH
 · \n
  ·  \n
  ·  \n

样例输出

复制
1/2
1/2
1/4
   \n
   \n
   \n

提交

请先 登录

© 2024 FAQs Contact About