eolymp
bolt
Try our new interface for solving problems
Problems

Subsequence

Subsequence

Given two strings s and t. Check, or a string s is a subsequence of string t.

Input

Two nonempty string s and t, containing only letters and digits (|s| ≤ 100, |t| ≤ 300).

Output

If the string s is a subsequence of the string t, output two lines: "YES" (without the quotes) and the minimum amount of characters in a string of indices t (indexing starts at 0), which is made up of a string s.

If the string s is not a subsequence of the string t, output "NO" (without quotes).

Time limit 1 second
Memory limit 128 MiB
Input example #1
aba baaba
Output example #1
YES
8
Input example #2
a1b2 abcd1234abcd
Output example #2
NO
Input example #3
dab aaddbb
Output example #3
NO
Input example #4
goodluck ggooddlluucckk
Output example #4
YES
45
Source The 2012 All-Ukrainian Collegiate Programming Contest Round I Training Contest 19 April 2012