#C7953. One Character Removal Transformation

    ID: 51881 Type: Default 1000ms 256MiB

One Character Removal Transformation

One Character Removal Transformation

You are given two strings S and T. Your task is to determine whether T can be obtained from S by removing exactly one character from S.

Formally, you need to check if there exists an index i such that by removing the i-th character from S the resulting string equals T (i.e. T = S[0:i] + S[i+1:]).

Note that the operation is allowed to be applied only once and the removal must be exactly one character.

Input Constraints:

  • 1 ≤ Q ≤ 104, where Q is the number of queries.
  • For each query, the length of S is exactly one more than the length of T.

Examples:

  • For S = "abc" and T = "ab", the answer is YES.
  • For S = "abcd" and T = "abc", the answer is YES.
  • For S = "abx" and T = "c", the answer is NO.

The answer should be output as YES or NO for each query.

inputFormat

The first line of input contains an integer Q, the number of queries.

Each of the next Q lines contains two strings separated by a space. The first string is S and the second string is T. Note that T might be an empty string. In that case, the line will contain S followed by a space.

outputFormat

For each query, output a single line containing YES if T can be obtained by removing exactly one character from S. Otherwise, output NO.

## sample
3
abc ab
abcd abc
abx c
YES

YES NO

</p>