Distinct Transformations

medium
1. You are given two strings S1 and S2.
2. You have to find the number of unique ways in which you can transform S1 to S2.
3. Transformation can be achieved by removing 0 or more characters from S1, such that the sequence formed by the remaining characters of S1 is identical to S2. 

Input Format

Two Strings S1 and S2

Output Format

A number representing the count of distinct transformations.

Constraints

1 <= length of strings S1 and S2 <= 1000

Example

Input
abcccdf
abccdf
Output
3
Previous
Minimum Cost To Make Two Strings Identical
Next
Maximum Difference Of Zeros And Ones In Binary String

Related Questions