#K84712. Can Transform String by Deleting One Character

    ID: 36481 Type: Default 1000ms 256MiB

Can Transform String by Deleting One Character

Can Transform String by Deleting One Character

Given two strings, s1 and s2, determine whether s1 can be transformed into s2 by deleting exactly one character from s1. Formally, you need to check if \( |s1| = |s2| + 1 \) and if by deleting one character from s1, the resulting string equals s2.

For example, if s1 = "abc" and s2 = "ab", the answer is "YES" because deleting the character 'c' from s1 yields s2. Conversely, if s1 = "abcdef" and s2 = "abcdefg", the answer is "NO".

inputFormat

The input begins with a single integer T on the first line representing the number of test cases. Each test case consists of two lines:

  1. The first line contains the string s1.
  2. The second line contains the string s2.

outputFormat

For each test case, output a single line containing either "YES" if s1 can be transformed into s2 by deleting exactly one character, or "NO" otherwise.

## sample
3
abc
ab
hello
helo
worlds
wolds
YES

YES YES

</p>