F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

String Game

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 477    Accepted Submission(s): 195


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$.
 

Sample Input
eeettt et eeettt te
 

Sample Output
9 0
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 08:00:12, Gzip enabled