We live in a society where personality is a distant memory.
Nowadays personality is represented by strings. You are given two strings and and an integer . You can apply following operation on the string at most times.
Suppose the final string after applying operations is called . You have to calculate the number of distinct strings where is a subsequence of after applying at most operations on string . Number of operations for each is independent you can apply at most operations in each time of making .
A subsequence of a string is a new string that is formed from the original string by deleting some (can be none or all) of the characters without disturbing the relative positions of the remaining characters. ( ace is a subsequence of abcde while aec is not).
The first line contains three integers , and size of the string , size of the string and maximum number of operations respectively.
The second line contains string containing only lowercase English letters.
The third line contains string containing only lowercase English letters.
Print a single integer total number of such distinct strings where is a subsequence of after applying at most operations for each .
2 1 2 ab a
The resulting strings are , .
2 3 1 aa aaa
Login to submit
This problem is straightforward. Generate all permutations of SSS, check is TTT is a subsequence and...