Problem:
M and A The CEO of the company named $S$ is planning M&A with another company named $T$. M&A is an abbreviation for "Mergers and Acquisitions". The CEO wants to keep the original company name $S$ through the M&A on the plea that both company names are mixed into a new one. The CEO insists that the mixed company name after the M&A is produced as follows. Let $s$ be an arbitrary subsequence of $S$, and $t$ be an arbitrary subsequence of $T$. The new company name must be a string of the same length to $S$ obtained by alternatively lining up the characters in $s$ and $t$. More formally, $s_0 + t_0 + s_1 + t_1 +  ...$ or $t_0 + s_0 + t_1 + s_1 + ... $ can be used as the company name after M&A. Here, $s_k$ denotes the $k$-th (0-based) character of string $s$. Please note that the lengths of $s$ and $t$ will be different if the length of $S$ is odd. In this case, the company name after M&A is obtained by $s_0 + t_0 + ... + t_{|S|/2} + s_{|S|/2+1}$ or $t_0 + s_0 + ... + s_{|S|/2} + t_{|S|/2+1}$ ($|S|$ denotes the length of $S$ and "/" denotes integer division). A subsequence of a string is a string which is obtained by erasing zero or more characters from the original string. For example, the strings "abe", "abcde" and "" (the empty string) are all subsequences of the string "abcde". You are a programmer employed by the acquiring company. You are assigned a task to write a program that determines whether it is possible to make $S$, which is the original company name, by mixing the two company names. Input The input consists of a single test case. The test case consists of two lines. The first line contains a string $S$ which denotes the name of the company that you belong to. The second line contains a string $T$ which denotes the name of the target company of the planned M&A. The two names $S$ and $T$ are non-empty and of the same length no longer than 1,000 characters, and all the characters used in the names are lowercase English letters. Output Print "Yes" in a line if it is possible to make original company name by combining $S$ and $T$. Otherwise, print "No" in a line. Sample Input 1 acmicpc
tsukuba Output for the Sample Input 1 No Sample Input 2 hoge
moen Output for the Sample Input 2 Yes Sample Input 3 abcdefg
xacxegx Output for the Sample Input 3 Yes

Solution (Python):


import sys
import math
import itertools as it
from collections import deque

sys.setrecursionlimit(10000000)

S_ = raw_input()
T_ = raw_input() + " "

S1 = S2 = ''
for i in range(len(S_)):
    if i % 2 == 0:
        S1 += S_[i]
    else:
        S2 += S_[i]

for S in [S1, S2]:
    T = T_
    for c in S:
        index = T.find(c)
        if index == -1:
            T = ""
            break
        T = T[index + 1:]
    
    if T != "":
        print "Yes"
        exit()
print "No"

Solution (Python):
def f(s,t):
    j=0;i=0
    while i<len(t) and j<len(s):
        if t[i]==s[j]:j+=2
        i+=1
    return j>=len(s)
I=input
s=I()
t=I()
print(['No','Yes'][f(s,t) or f(s[1:],t)])

Solution (Python):
def judge(s):
    if len(s) == 0: return True
    si = 0
    for t in T:
        if t == s[si]:
            si += 1
            if si == len(s): return True
    return False

S,T = input(),input()
N = len(S)
print('Yes' if judge(S[::2]) or judge(S[1::2]) else 'No')

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        s = S()
        t = S()
        l = len(t)
        def f(s):
            i = 0
            for c in s:
                while i < l and t[i] != c:
                    i += 1
                if i == l:
                    return False
                i += 1
            return True

        if f(s[0::2]) or f(s[1::2]):
            rr.append('Yes')
        else:
            rr.append('No')

        break



    return '\n'.join(map(str, rr))


print(main())

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    n = I()
    s = 0
    ans = "YES"
    for i in range(n):
        k = input()
        if k == "Un":
            s -= 1
        else:
            s += 1
        if s < 0:
            ans = "NO"
    if s:
        print("NO")
    else:
        print(ans)
    return


def B():
    s = S()
    t = S()
    n = len(s)
    t_ = [s[i*2] for i in range(n//2)]
    j = 0
    if not t_:
        print("Yes")
        quit()
    for i in range(n):
        if t_[j] == t[i]:
            j += 1
            if j == len(t_):
                print("Yes")
                quit()
    t_ = [s[i*2+1] for i in range(n//2)]
    j = 0
    if not t_:
        print("Yes")
        quit()
    for i in range(n):
        if t_[j] == t[i]:
            j += 1
            if j == len(t_):
                print("Yes")
                quit()
    print("No")
    return


def C():
    n,q = LI()
    p = LIR(n)
    for _ in range(q):
        x0,y0,z0,s,t,u = LI()
        a,b,c = (s-x0,t-y0,u-z0)
        ans = 0
        su = a**2+b**2+c**2
        for xr,yr,zr,r,l in p:
            x = (su-a**2)/su*x0-a/su*(b*y0+c*z0-a*xr-b*yr-c*zr)
            y = (su-b**2)/su*y0-b/su*(a*x0+c*z0-a*xr-b*yr-c*zr)
            z = (su-c**2)/su*z0-c/su*(b*y0+a*x0-a*xr-b*yr-c*zr)
            if min(x0,s)-1e-4 <= x <= max(x0,s)+1e-4 and min(y0,t)-1e-4 <= y <= max(y0,t)+1e-4 and min(z0,u)-1e-4 <= z <= max(z0,u)+1e-4:
                x -= xr
                y -= yr
                z -= zr
                r2 = x**2+y**2+z**2
                if r2 <= r**2+1e-4:
                    ans += l
        print(ans)
    return


def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


def I_():
    return


def J():
    return


if __name__ == "__main__":
    B()