7408: Rule of Three(Problem J5)
内存限制:128 MB
时间限制:1.000 S
评测方式:文本比较
命题人:
提交:4
解决:0
题目描述
输入
输出
The output will be S lines long and describes the substitutions in order.
样例输入 复制
AA AB
AB BB
B AA
4 AB AAAB
样例输出 复制
2 1 BB
3 1 AAB
3 3 AAAA
1 3 AAAB
提示
This is the example outlined in the problem description. Note that the following is another possible
valid substitution sequence:
2 1 BB
3 2 BAA
1 2 BAB
3 1 AAAB
Specifically, showing the substitutions in bold, we get AB → BB → BAA → BAB → AAAB.
2 1 BB
3 2 BAA
1 2 BAB
3 1 AAAB
Specifically, showing the substitutions in bold, we get AB → BB → BAA → BAB → AAAB.