#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define tc  ll t; cin>>t; while(t--)
#define io ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define F first
#define S second
ll gcd(ll n,ll m)
{
    if(n==0)
            return m;
    return gcd(m%n,n);
}
bool ifprime(ll n)
{
if(n==1)
return false;
	ll i;
for(i=2;i*i<=n;i++)
{
if(n%i==0)
return false;

}
return true;
}
void disp(vector<int> v)
{
    for(auto u:v)
    cout<<u<<" ";
    cout<<"\n";
}
void remleadzero(vector<int> &v)
{
    vector<int> u;
    int i=0;
    while(v[i]==0)
        i++;
    while(i<v.size())
    {
        u.push_back(v[i]);
        i++;
    }
    v=u;
}
//#define mod 1000000007
/*
void myscanf(long long *n)
{
    register long long c=getchar_unlocked();
    *n=0;
    for(;(c<48 ||c>57);c=getchar_unlocked())
        ;
    for(;(c>47 && c<58);c=getchar_unlocked())
    {
        *n=(*n<<1)+(*n<<3)+(c&15);
    }

}
void fastscan(long long &number)
{
    bool negative = false;
    register long long c;

    number = 0;

    c = getchar_unlocked();
    if (c=='-')
    {

        negative = true;

        c = getchar_unlocked();
    }


    for (; (c>47 && c<58); c=getchar_unlocked())
        number = number *10 + c - 48;


    if (negative)
        number *= -1;
}
*/
void appzero(vector<int> &v1,vector<int> &v2)
{
    if(v1.size()>v2.size())
    {
        int k=v1.size()-v2.size();
        vector<int> v;
        while(k--)
            v.push_back(0);
        for(int i=0;i<v2.size();i++)
            v.push_back(v2[i]);
        v2=v;
    }
    else
    {
        int k=v2.size()-v1.size();
        vector<int> v;
        while(k--)
            v.push_back(0);
        for(int i=0;i<v1.size();i++)
            v.push_back(v1[i]);
        v1=v;
    }
}
ll powu[10000000];
void powten(ll m,ll siz)
    {
        powu[0]=1;
        for(int i=1;i<siz+2;i++)
            powu[i]=(powu[i-1]*10)%m;
    }
class Big
{

public:
    vector<int> vx;
    vector<int> vy;
    Big(vector<int> a,vector<int> b)
    {
        vx=a;
        vy=b;

    }
    vector<int> add(vector<int> v1,vector<int> v2)
    {
        if(v1.size()!=v2.size())
            appzero(v1,v2);
        ll n=v1.size();
        vector<int> ans(n+1);

        int carry=0;
        for(int i=n-1;i>=0;i--)
        {
            ans[i+1]=(v1[i]+v2[i]+carry)%10;
            carry=(v1[i]+v2[i]+carry)/10;
        }
        ans[0]=carry;
        remleadzero(ans);
        return ans;
    }
    vector<int> sub(vector<int> v1,vector<int> v2)
    {
        if(v1.size()!=v2.size())
            appzero(v1,v2);
        ll n=v1.size();
        vector<int> ans(n);

        int carry=0;
        for(int i=n-1;i>=0;i--)
        {
            ans[i]=(v1[i]-v2[i]+carry+10)%10;
            carry=floor((float)(v1[i]-v2[i]+carry)/10);
            //cout<<carry<<"\n";
        }

        if(-carry<0)
            ans.push_back(-1);
        remleadzero(ans);
        return ans;
    }

    ll mod(vector<int> vec,ll m)
    {
        ll n=vec.size(),ans=0;
        powten(m,n);
        for(int i=n-1;i>=0;i--)
        {
            ans+=(powu[n-i-1]*vec[i])%m;
        }
        return ans%m;
    }
    vector<int> pro1(vector<int> v1,int a)
    {

        ll n=v1.size();
        vector<int> ans(n+1);
        int carry=0;
        for(int i=n-1;i>=0;i--)
        {
            ans[i+1]=(v1[i]*a+carry)%10;
            carry=(v1[i]*a+carry)/10;
        }
        ans[0]=carry;
        remleadzero(ans);
        return ans;
    }
    vector<int> pro(vector<int> v1,vector<int> v2)
    {
        if(v2.size()==1)
            return pro1(v1,v2[0]);

        ll n=v2.size();
        vector<int> ans;
        ans=pro1(v1,v2[0]);
        for(int i=1;i<n;i++)
        {
            ans.push_back(0);
            vector<int> u=pro1(v1,v2[i]);
            /*int z=i-n+2;
            while(z>0)
            {
                u.push_back(0);
                z--;
            }*/
            ans=add(ans,u);
            //disp(ans);
        }
        remleadzero(ans);
        return ans;
    }
};
vector<int> strtovec(string s)
{
    vector<int> v;
    for(int i=0;i<s.size();i++)
        v.push_back(s[i]-'0');
    return v;
}
vector<int> strtov(string s)
{
    vector<int> v;
    for(int i=0;i<s.size();i++)
        v.push_back(s[i]-'a');
    return v;
}
vector<int> minus2;
vector<int> one;
vector<int> dp[1001][2];
Big o=Big(minus2,one);
vector<int> f(ll n,ll m)
{

    if(dp[n][m]!=minus2)
    return dp[n][m];
    if(n==0||n==1)
    return one;
    vector<int> q;
    q.push_back(0);
    ll i=1;
    while(n-i>=0)
    {
        q=o.add(q,f(n-i,!m));

        i+=2;
    }
    dp[n][m]=q;
    return q;
}

ll fast_exponentiation(ll n,ll m)
{
    ll a=1;
    while(m>0)
    {
        if(m&1==1) a=a*n;
        n=n*n;
        m/=2;
    }
    return a;
}
ll solve(ll a,ll b)
{


        ll a1=__builtin_popcount(a),b1=__builtin_popcount(b),btrail=__builtin_ctz(b),atrail=__builtin_ctz(a);
        if(a==b)
            return 0;
        else if(a!=0&&(b==0||b==1))
            return -1;

        else if(a1<b1)
        {
            return (b1-a1+btrail);
        }
        else if(b1==a1)
        {
            if(btrail!=0)
                return btrail;
            else
                return 2;
        }
        else
        {
            if(btrail==0)
                cout<<"2\n";
            else
            {
                return 1+solve(a,b-1);

                /*if(b1+btrail-1>a1)
                cout<<b1-a1+btrail<<"\n";
                else
                {

                    cout<<"3\n";
                }*/

            }
        }
}
long double modcrossp(vector<long double> v1,vector<long double> v2)
{
    return sqrt((v1[1]*v2[2]-v1[2]*v2[1])*(v1[1]*v2[2]-v1[2]*v2[1])+(v1[0]*v2[2]-v1[2]*v2[0])*(v1[0]*v2[2]-v1[2]*v2[0])+(v1[0]*v2[1]-v1[1]*v2[0])*(v1[0]*v2[1]-v1[1]*v2[0]));
}
long double vecmod(vector<long double> v)
{
    return sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]);
}
long double bins(vector<long double> c,vector<long double> q_t,vector<long double> p,long double t)
{
    int i;
    vector<long double> pq_t(3),pc(3);
    for(i=0;i<3;i++)
        pq_t[i]=p[i]-q_t[i];
    for(i=0;i<3;i++)
        pc[i]=p[i]-c[i];
        return modcrossp(pc,pq_t)/vecmod(pq_t);
}
string vectostr(vector<ll> v)
{
    string s;
    ll i;
    for(i=0;i<v.size();i++)
    s[i]=char(v[i]+'a');
    return s;
}
/*
int i,j,n,m;
vector<pair<int,int>> adj[2001][2001];
bool vis[2001][2001];
int weight[4004001]={1};
set<pair<int,int>> S[4004001];
int index[2001][2001];
int ind=0;
bool che(int a,int b)
{
    if(a>=0&&a<n&&b>=0&&b<m)
        return true;
    return false;
}
int a[2001][2001];
int ival[4004001];
int jval[4004001];
void dfs(int i,int j,int ind)
{
    if(vis[i][j])
        return;

    vis[i][j]=true;
    index[i][j]=ind;
    ival[ind]=i;
    jval[ind]=j;
    for(auto u : adj[i][j])
    {
        if(a[u.first][u.second]==a[i][j]&&!vis[u.first][u.second])
            {
                dfs(u.first,u.second,ind);
                index[u.first][u.second]=ind;

                weight[ind]++;
            }
        else if(a[u.first][u.second]!=a[i][j])
        {
            S[ind].insert(u);
        }
    }
}
*/
int main()
{
    string s1,s2;
    cin>>s1>>s2;
    if(s1==s2)
    {
        cout<<"Yes\n";
        return 0;
    }
    ll i,j,cur,n=s1.size();
    for(i=0;i<n;i++)
    {
        j=0;
        cur=i;
        while(s1[i]==s2[j]&&i<n)
        {
            i++;
            j++;
        }
        if(i==n)
        {
            break;
        }
    }
   //cout<<cur<<" "<<j<<"\n";
    for(i=0;i<cur&&j<s2.size();i++,j++)
    {
        if(s1[i]!=s2[j]&&i<cur&&j<s2.size())
        {
            
            cout<<"No\n";
            return 0;
            
        }
        
    }
    cout<<"Yes\n";
    return 0;
}





Measured memory_bytes: 256