
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a, b;
    int size, count;
    cin >> a >> b;
    size = a.length();
    count = 0;
    for (int i = 0; i < size; i++)
    {
        char c, d;
        c = a[i];
        d = b[i];
         if (c==d)
        {
            //cout << c << d << "/n" << endl;
            count++;
        }
    }
    if(count == size)
    cout << "YES" << endl;
    else
    {
        cout << "No" << endl;
    }

}