#P6915. String Game

    ID: 5772 远端评测题 1000ms 256MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>“红旗杯”第十四届吉林省大学生程序设计竞赛

String Game

Problem Description

Clair and Bob play a game.Clair writes a string of lowercase characters, in which Bob sets the puzzle by selecting one of his favorite subsequence as the key word of the game. But Bob was so stupid that he might get some letters wrong.

Now Clair wants to know whether Bob's string is a subsequence of Clair's string. and how many times does Bob's string appear as a subsequence in Clair's string. As the answer maybe too large, you should output the answer modulo $10^{9}+7$.

Input

The input may contain multiple test cases.

Each test case contains exactly two lines. The first line is Clair’s string, and the second line is Bob’s string. The length of both strings are no more than 5000.

Output

For each test case, output one line, including a single integer representing how many times Bob’s string appears as a subsequence in Clair’s string. The answer should modulo $10^{9} + 7$.

eeettt et eeettt te
9 0