#C7361. Taco: Check Substring Insertion Possibility

    ID: 51224 Type: Default 1000ms 256MiB

Taco: Check Substring Insertion Possibility

Taco: Check Substring Insertion Possibility

You are given two strings, s and t. You are allowed to perform exactly one insertion operation on s: insert any one character from t into any position (possibly at the beginning or end) of s. The task is to determine whether it is possible to make t appear as a contiguous substring in the new string after the insertion.

Detailed Explanation:

For every possible insertion position in s and every character c in t, you construct a new string by inserting c at that position in s. If t becomes a substring of this new string, output YES. Otherwise, output NO.

Examples:

  • For s = "abxyca" and t = "abc", the answer is YES.
  • For s = "abcd" and t = "ef", the answer is NO.

inputFormat

The input is read from standard input (stdin) and consists of two lines:

  • The first line contains the string s.
  • The second line contains the string t.

outputFormat

Output a single line to standard output (stdout) containing YES if it is possible to insert exactly one character from t into s such that t becomes a substring of the resulting string. Otherwise, output NO.

## sample
abxyca
abc
YES