ラーニングアルゴリズム-シーケンスを表示
1322 ワード
✔ Check source in github
Design a code that determines the number of cases in which the string X appears in the string Z.
The first line of the input contains an integer N indicating the number of test cases to follow. The first line of each test case contains a string X, composed entirely of lowercase alphabetic characters and having length no greater than 10,000. The second line contains another string Z having length no greater than 100 and also composed of only lowercase alphabetic characters. Be assured that neither Z nor any prefix or suffix of Z will have more than 10100 distinct occurrences in X as a subsequence. For each test case, output the number of distinct occurrences of Z in X as a subsequence. Output for each input set must be on a separate line.
Explan
Example
Input
2 2
babgbag moonnekky
bag monkey
rabbbit abcbbcc
rabbit abc
2 2
babgbag moonnekky
bag monkey
rabbbit abcbbcc
rabbit abc
Output
5 8
3 7
Reference
この問題について(ラーニングアルゴリズム-シーケンスを表示), 我々は、より多くの情報をここで見つけました https://velog.io/@jomo34/스터디-알고리즘-Distinct-Subsequencesテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol