

If Typed = “aaabcc” and Expected = “abc”
Then, while trying to type “abc” one might long press ‘a’ and that would result in typing three consecutive a’s. This if followed by correctly pressing ‘b’ once and in the end he might long press ‘c’ resulting in typing it twice, the resulting text typed in this case is equal to “aaabcc” and therefore we will return “true”.
The first line contains a single integer ‘T’ denoting the number of test cases, then each test case follows:
The first line of each test case contains a string ‘Expected’ that denotes the original text that was to be typed.
The second line of each test case contains a string ‘Typed’ that denotes the text that was actually typed.
For each test case, print the “true” if the text was typed correctly, else print “false”.
Output for each test case will be printed in a separate line.
You are not required to print anything; it has already been taken care of. Just implement the function.
1 ≤ T ≤ 10
1 ≤ |Expected| ≤ 5000
1 ≤ |Typed| ≤ 5000
Both the strings consist of lowercase English alphabets
Time limit: 1 sec
Initialize two pointers to point to the beginning of each string. Run a while loop, check if both the pointers point to the same characters or not, in case they point to different characters then return “False” as this is the case when it is not possible to match the strings as a different character is typed or the order in which characters were typed is different. If the current characters pointed by both the pointers match then run a while loop to take increase the pointer pointing the ‘Typed’ text if needed to consider the condition of using the faulty keyboard. Break the outer while loop if both the pointers point to the end of their respective strings and return “True” as this will denote that we have matched the condition of the faulty keyboard. In case only one of the pointers points to the end of its string then return “False” as this is the case when we might have pressed some extra incorrect keys in the end or might have pressed fewer keys than that were actually to be pressed for typing the text.
The steps are as follows :