问题1450--A Coin Tossing Game

1450: A Coin Tossing Game

时间限制: 1 Sec  内存限制: 32 MB
提交: 11  解决: 1
[状态] [讨论版] [提交] [命题人:]
题目描述

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.

样例输入 Copy
H T
HT TH
HH TH
样例输出 Copy
1/2
1/2
1/4
来源/分类