Methodius received an email from his friend Polycarp. However, Polycarp's keyboard is broken, so pressing a key on it once may cause the corresponding symbol to appear more than once (if you press a key on a regular keyboard, it prints exactly one symbol).

For example, as a result of typing the word "hello", the following words could be printed: "hello", "hhhhello", "hheeeellllooo", but the following could not be printed: "hell", "helo", "hhllllooo".

Note, that when you press a key, the corresponding symbol must appear (possibly, more than once). The keyboard is broken in a random manner, it means that pressing the same key you can get the different number of letters in the result.

For each word in the letter, Methodius has guessed what word Polycarp actually wanted to write, but he is not sure about it, so he asks you to help him.

You are given a list of pairs of words. For each pair, determine if the second word could be printed by typing the first one on Polycarp's keyboard.


-----Input-----

The first line of the input contains one integer $n$ ($1 \le n \le 10^5$) — the number of pairs to check. Further input contains $n$ descriptions of pairs.

The first line of each description contains a single non-empty word $s$ consisting of lowercase Latin letters. The second line of the description contains a single non-empty word $t$ consisting of lowercase Latin letters. The lengths of both strings are not greater than $10^6$.

It is guaranteed that the total length of all words $s$ in the input is not greater than $10^6$. Also, it is guaranteed that the total length of all words $t$ in the input is not greater than $10^6$.


-----Output-----

Output $n$ lines. In the $i$-th line for the $i$-th pair of words $s$ and $t$ print YES if the word $t$ could be printed by typing the word $s$. Otherwise, print NO.


-----Examples-----
Input
4
hello
hello
hello
helloo
hello
hlllloo
hello
helo

Output
YES
YES
NO
NO

Input
5
aa
bb
codeforces
codeforce
polycarp
poolycarpp
aaaa
aaaab
abcdefghijklmnopqrstuvwxyz
zabcdefghijklmnopqrstuvwxyz

Output
NO
NO
YES
NO
NO

Difficulty: interview

Starter code:

Solutions:
#!/usr/bin/env python
import sys
input = sys.stdin.readline


def cnt(s):
    l = [[s[0], 1]]
    for c in s[1:]:
        if l[-1][0] == c:
            l[-1][1] += 1
        else:
            l.append([c, 1])
    return l


def cmp(sc, tc):
    if len(tc) != len(sc):
        # print(f'sc = {sc}, tc = {tc}')
        return False
    for i in range(len(tc)):
        if tc[i][0] != sc[i][0] or tc[i][1] < sc[i][1]:
            # print(f'sc = {sc}, tc = {tc}, i = {i}')
            return False
    return True


for _ in range(int(input())):
    s, t = input().strip(), input().strip()
    sc, tc = cnt(s), cnt(t)
    print('YES' if cmp(sc, tc) else 'NO')



n = int(input())

for _ in range(n):
	s1 = input()
	s2 = input()

	d1 = []
	d2 = []

	actual = s1[0]
	cont = 1

	for c in s1[1:]:
		if c != actual:
			d1.append((actual, cont))
			actual = c
			cont = 1
		else:
			cont += 1
	d1.append((actual, cont))

	actual = s2[0]
	cont = 1

	for c in s2[1:]:
		if c != actual:
			d2.append((actual, cont))
			actual = c
			cont = 1
		else:
			cont += 1
	d2.append((actual, cont))

	if len(d1) != len(d2):
		print("NO")
	else:
		for a, b in zip(d1, d2):
			if a[0] != b[0] or a[1] > b[1]:
				print("NO")
				break
		else:
			print("YES")


for i in range(int(input())):
    s = input()
    t = input()
    j = 0
    i = 0
    if len(t) < len(s):
        print('NO')
        continue
    while i < len(s):
        f = True
        cu = s[i]
        cou = 1
        i += 1
        while i < len(s) and s[i] == cu:
            cou += 1
            i += 1
        while cou > 0:
            if j >= len(t) or t[j] != cu:
                f = False
                break
            else:
                cou -= 1
                j += 1
        if not f:
            break
        while j < len(t) and t[j] == cu:
            j += 1
    if f and j == len(t):
        print('YES')
    else:
        print('NO')


import sys
input = sys.stdin.readline

n=int(input())
for i in range(n):
    A=input().strip()
    B=input().strip()

    AA=[]
    AA.append([A[0],1])
    for i in range(1,len(A)):
        if A[i]==A[i-1]:
            AA[-1][1]+=1
        else:
            AA.append([A[i],1])

    BB=[]
    BB.append([B[0],1])
    for i in range(1,len(B)):
        if B[i]==B[i-1]:
            BB[-1][1]+=1
        else:
            BB.append([B[i],1])

    #print(AA,BB)

    if len(AA)!=len(BB):
        print("NO")
    else:
        for i in range(len(AA)):
            if AA[i][0]==BB[i][0] and AA[i][1]<=BB[i][1]:
                continue
            else:
                print("NO")
                break

        else:
            print("YES")
        


#print('Hare Krishna')
def I():
    return int(input())
def IL():
    return [int(i) for i in input().split()]
def IS():
    return input()
def IM():
    return map(int,input().split())
t=I()
for i in range(t):
    s1=IS()
    s2=IS() 
    f=1 
    if len(s1)>len(s2):
        print('NO')
        continue 
    if len(s1)==len(s2):
        print('YES' if s1==s2 else 'NO')
        continue 
    grps1=[] 
    grps2=[]
    i=0 
    n=len(s1)
    m=len(s2)
    while i<n:
        curr=s1[i]
        c=0 
        while i<n and s1[i]==curr:
            c+=1 
            i+=1 
        grps1.append([curr,c])
    i=0 
    while i<m:
        curr=s2[i]
        c=0 
        while i<m and s2[i]==curr:
            c+=1 
            i+=1 
        grps2.append([curr,c])
    #print(grps1,grps2)
    if len(grps1)!=len(grps2):
        print('NO')
        continue 
    f=1 
    for i in range(len(grps1)):
        if grps1[i][0]!=grps2[i][0] or grps1[i][1]>grps2[i][1]:
            f=0 
    print('YES' if f else 'NO')

def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))

def solve():
    first = input()
    second = input()
    fbuf = []
    sbuf = []
    fcur = "0"
    scur = "0"
    for c in first:
        if fcur[-1] != c:
            fbuf.append(fcur)
            fcur = c
        else:
            fcur += c
    fbuf.append(fcur)

    for c in second:
        if scur[-1] != c:
            sbuf.append(scur)
            scur = c
        else:
            scur += c
    sbuf.append(scur)

    # print(fbuf, sbuf)
    if len(fbuf) != len(sbuf):
        print("NO")
        return

    for f, s in zip(fbuf, sbuf):
        if f[0] != s[0]:
            print("NO")
            return

        if len(f) > len(s):
            print("NO")
            return

    print("YES")
    return


n = getN()

for i in range(n):
    solve()

import sys
input = iter(sys.stdin.read().splitlines()).__next__

n = int(input())

def prep(s):
    S = []
    lc = None
    count = 0
    for c in s:
        if c != lc and count:
            S.append((lc,count))
            count = 0
        count += 1
        lc = c
    if count:
        S.append((lc,count))
    return S


for _ in range(n):
    t = input()
    s = input()

    T = prep(t)
    S = prep(s)
    if len(T) == len(S):
        for i in range(len(T)):
            if T[i][0] != S[i][0] or T[i][1] > S[i][1]:
                break
        else:
            print('YES')
            continue
        print('NO')
    else:
        print('NO')


def solve(a, b):
    i=0
    for j in range(len(b)):
        if j and i < len(a) - 1 and a[i+1] == b[j]:
            i += 1
        elif b[j] != a[i]:
            return False
    return i == len(a) - 1



t=int(input())
for _ in range(t):
    a=input()
    b=input()
    print('YES' if solve(a, b) else 'NO')


# alpha = "abcdefghijklmnopqrstuvwxyz"
# prime = 998244353 
# INF = 1000_000_000

# from heapq import heappush, heappop
# from collections import defaultdict
# from math import sqrt
# from collections import deque      
    
t = int(input())

for test in range(t):
    # n = int(input())
    # a,b,c,d = map(int, input().split())
    s = input()
    t = input()
    arr_s = []
    arr_t = []

    prev = "1"
    for i in s:
        if i==prev:
            arr_s[-1][1]+=1
        else:
            arr_s.append([i,1])
            prev = i

    prev = "1"
    for i in t:
        if i==prev:
            arr_t[-1][1]+=1
        else:
            arr_t.append([i,1])
            prev = i

    ans = "YES"
    if len(arr_s)==len(arr_t):
        for i in range(len(arr_s)):
            if arr_s[i][0] == arr_t[i][0] and arr_s[i][1] <= arr_t[i][1]:
                continue
            else:
                ans = "NO"
    else:
        ans="NO"
    print(ans)


n = int(input())
for k in range(n):
    s = input()
    t = input()
    i = 0
    j = 0
    while i < len(s) and j < len(t):
        if s[i] == t[j]:
            if i < len(s) - 1 and s[i] != s[i + 1]:
                while j < len(t) and s[i] == t[j]:
                    j += 1
                i += 1
            elif i == len(s) - 1:
                while j < len(t) and s[i] == t[j]:
                    j += 1
                i += 1
            else:
                i += 1
                j += 1
        else:
            break
    if i == len(s) and j == len(t):
        print('YES')
    else:
        print('NO')

import sys
input = sys.stdin.readline

def chk(s, t):
    i = 0
    j = 0
    while True:
        if i < len(s) and j < len(t) and s[i] == t[j]:
            while j < len(t) - 1 and t[j+1] == t[j] and (i == len(s)-1 or s[i+1] != s[i]):
                j += 1
            i += 1
            j += 1
            # print(i, j)
            if i == len(s) and j == len(t):
                return "YES"
        else:
            return "NO"

for _ in range(int(input())):
    print(chk(input(), input()))


for e in range(int(input())):
    s, t = input(), input()
    u = 0
    j = 0
    f = 1
    while u < len(s) and j < len(t):
        if s[u] == t[j]:
            u += 1
            j += 1
        else:
            if u and s[u - 1] == t[j]:
                j += 1
            else:
                f = 0
                break
    if f and u == len(s) and (j == len(t) or {s[-1]} == set(t[j:])):
        print('YES')
    else:
        print('NO')

for i in range(int(input())):
    a = input()
    b = input()
    di = [[a[0], 1]]
    for i in a[1:]:
        if di[-1][0] == i:
            di[-1][1] += 1
        else:
            di.append([i, 1])
    di2 = [[b[0], 1]]
    for i in b[1:]:
        if di2[-1][0] == i:
            di2[-1][1] += 1
        else:
            di2.append([i, 1])
    if len(di) != len(di2):
        print("NO")
        continue
    f = 0
    for i in range(len(di)):
        if di[i][0] == di2[i][0] and di[i][1] <= di2[i][1]:
            continue
        f = 1
        break
    if f:
        print("NO")
    else:
        print("YES")

import sys 
read = lambda : sys.stdin.readline().strip()

for t in range(int(input())):
  a, b = read(), read()
  A, B = [], []
  for i in a:
    if not A:
      A.append((1, i))
    else:
      cnt, char = A[-1]
      if char == i:
        A[-1] = (cnt+1, char)
      else:
        A.append((1, i))
  
  for i in b:
    if not B:
      B.append((1, i))
    else:
      cnt, char = B[-1]
      if char == i:
        B[-1] = (cnt+1, char)
      else:
        B.append((1, i))
    
  if len(A) != len(B):
    sys.stdout.write("NO\n")
  else:
    flag = True 
    for i, j in zip(A, B):
      if j[0] < i[0] or i[1] != j[1]:    
        sys.stdout.write("NO\n")
        flag = False 
        break
    if flag:
      sys.stdout.write("YES\n")
     
  


n = int(input())
for i in range(n):
    s = input()
    c = input()
    a = []
    b = []
    p = -1
    cnt = 0
    la = 0
    for el in s:
        if p == -1:
            p = el
            cnt += 1
        else:
            if el == p:
                cnt += 1
            else:
                a.append((cnt, p))
                cnt = 1
                la += 1
        p = el
    if cnt != 0:
        a.append((cnt, p))
        la += 1
    p = -1
    cnt = 0
    lb = 0
    for el in c:
        if p == -1:
            p = el
            cnt += 1
        else:
            if el == p:
                cnt += 1
            else:
                b.append((cnt, p))
                cnt = 1
                lb += 1
        p = el
    if cnt != 0:
        b.append((cnt, p))
        lb += 1
    if la != lb:
        print('NO')
        continue
    r = 'YES'
    for i in range(la):
        if a[i][1] != b[i][1] or a[i][0] > b[i][0]:
            r = 'NO'
    print(r)

import itertools
n = int(input())
for _ in range(n):
    s = list(input())
    t = list(input())
    sgr = itertools.groupby(s)
    tgr = itertools.groupby(t)
    slist = []
    tlist = []
    for key, group in sgr:
        slist.append([key, len(list(group))])
    for key, group in tgr:
        tlist.append([key, len(list(group))])
    if len(slist) != len(tlist):
        print("NO")
    else:
        flag = 1
        for i in range(len(slist)):
            if slist[i][0] == tlist[i][0] and slist[i][1] <= tlist[i][1]:
                continue
            else:
                flag = 0
                break
        if flag == 1:
            print("YES")
        else:
            print("NO")


from collections import deque as D
t = int(input())
for _ in range(t):
    a = D(list(input()))
    b = D(list(input()))
    p = None
    f = True
    while a and b:
        x = a.popleft()
        if b[0] == x:
            b.popleft()
        elif b[0] == p:
            while b and b[0] == p:
                b.popleft()
            if not b:
                f = False
                break
            if b[0] == x:
                b.popleft()
            else:
                f = False
        else:
            f = False
        p = x
    if a:
        f = False
    if b and set(b) != {p}:
        f = False
    if f:
        print('YES')
    else:
        print('NO')



import sys


def check_str(s, t):
    i, j = 0, 0
    ls, lt = len(s), len(t)
    while i < ls:
        cur, cnt = s[i], 0
        while i < ls and s[i] == cur:
            cnt += 1
            i += 1

        while j < lt and t[j] == cur:
            cnt -= 1
            j += 1

        if cnt > 0:
            return False

    return True if j == lt else False


def main():
    n = int(input())
    for _ in range(n):
        s = input()
        t = input()
        print('YES' if check_str(s, t) else 'NO')


def __starting_point():
    if len(sys.argv) > 1 and sys.argv[1] == 'True':
        IS_LOCAL = True
    main()

__starting_point()

n=int(input())
for tee in range(n):
	s=input()
	t=input()
	if len(s)>len(t):
		print("NO")
		continue 
	if len(s)==len(t):
		if s==t:
			print("YES")
		else:
			print("NO")
		continue
	arr=[]
	i=0
	pre=None
	cc=0
	while i<len(s):
		if pre==None:
			pre=s[i]
			cc=1
		else:
			if pre==s[i]:
				cc+=1
			else:
				arr.append([pre,cc])
				pre=s[i]
				cc=1 
		i+=1
	arr.append([pre,cc])
	brr=[]
	i=0
	pre=None
	cc=0
	while i<len(t):
		if pre==None:
			pre=t[i]
			cc=1
		else:
			if pre==t[i]:
				cc+=1
			else:
				brr.append([pre,cc])
				pre=t[i]
				cc=1 
		i+=1
	brr.append([pre,cc])
	# print(arr)
	# print(brr)
	if len(brr)!=len(arr):
		print("NO")
	else:
		check=True
		for i in range(len(arr)):
			if arr[i][0]!=brr[i][0] or arr[i][1]>brr[i][1]:
				check=False
				break
		if not check:
			print("NO")
		else:
			print("YES")

import sys


input = sys.stdin.readline
n = int(input())
word = [input() for i in range(2*n)]

for i in range(n):
    word0 = word[i*2]
    word1 = word[i*2 + 1]
    li0 = [[word0[0], 1]]
    li1 = [[word1[0], 1]]
    for i in range(1, len(word0)):
        if li0[-1][0] == word0[i]:
            li0[-1][1] += 1
        else:
            li0.append([word0[i], 1])

    for i in range(1, len(word1)):
        if li1[-1][0] == word1[i]:
            li1[-1][1] += 1
        else:
            li1.append([word1[i], 1])
    for i in range(len(li0)):
        if li0[i][0] == li1[i][0] and li0[i][1] <= li1[i][1]:
            continue
        else:
            print("NO")
            break
    else:
        print("YES")
          



n = int(input())
for _ in range(n):
    s = input()
    t = input()
    i, j = 0, 0
    while i < len(s):
        c = s[i]
        x, y = 0, 0
        while i < len(s) and s[i] == c:
            i += 1
            x += 1
        while j < len(t) and t[j] == c:
            j += 1
            y += 1
        if x > y:
            print('NO')
            break
    else:
        print('YES' if j == len(t) else 'NO')


n=int(input())
for i in range(n):
    s=list(input())
    s.append(0)
    dan=[]
    counter=1
    for i in  range(1,len(s)):
        if s[i]!=s[i-1]:
            dan.append((s[i-1],counter))
            counter=1
        else:
            counter+=1
    t=list(input())
    t.append(0)
    j=0
    lena=len(dan)
    counter=1
    for i in range(1,len(t)):
        if t[i]!=t[i-1]:
            if j>=lena:
                print('NO')
                break
            if t[i-1]==dan[j][0] and counter>=dan[j][1]:
                j+=1
                counter=1
            else:
                print('NO')
                break
        else:
            counter+=1
    else:
        if j==lena:
            print('YES')
        else:
            print('NO')