2310: A Coin Tossing Game

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:2 解决: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.

样例输入 复制

H T
HT TH
HH TH

样例输出 复制

1/2
1/2
1/4

来源/分类