 New update is available. Click here to update.

# Valid Word Abbreviations

Last Updated: 18 Feb, 2021
Difficulty: Easy

## PROBLEM STATEMENT

#### 1) While matching, if we encounter a number ‘X’ in ‘ABBR’, then we have to skip ‘X’ characters in ‘STR’ and keep on matching.

``````For example: For ‘STR’ = “abc”, all valid matching ‘ABBR’ are: [“abc”, “1bc”, “1b1”, “2c”, “3”, “a1c”, “a2”, “ab1”].
``````

#### For example :

``````If ‘STR’ = “hello” and ‘ABBR’= “1e2o”.
1. As ‘STR’=’h’ but ‘ABBR’=1 which means we can skip 1 character from ‘STR’ so continue matching.
2. ‘STR’=’e’ and ‘ABBR’=’e’ (matches) so continue matching.
3.‘STR’=’l’ and ‘ABBR’=2 which means we can skip 2 characters from ‘STR’ so continue matching.
4. We will not match the 3rd index as skipped in the earlier step.
4.‘STR’=’o’ and ‘ABBR’=’o’ (matches).
So we can say ‘STR’ matches with ‘ABBR’ and return TRUE.
``````

#### Input Format :

``````The first line of input contains a single integer T, representing the number of test cases.
Then the T test cases follow.
First and the only line of each test case contains two single space-separated strings representing ‘STR’ and ‘ABBR’ respectively.
``````

#### Output format :

``````For every test case, print ‘YES’ if ‘STR’ matches ‘ABBR’ else print ‘NO’.
The output of each test case is printed in a separate line.
``````

#### Note :

``````You don’t have to print anything. It has already been taken care of. Just implement the given function.
``````

#### Constraints :

``````1<= T <=100
1<= |STR| and |ABBR| <=10^4

Time limit: 1 second
``````