纯暴力

#include <bits/stdc++.h>
using namespace std;
unordered_map<char, int> st;
int main()
{
    string a, b;
    cin >> a >> b;
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    for (int i = 0; i < a.size(); i++)
    {
        st[a[i]]++;
    }
    a.erase(unique(a.begin(), a.end()), a.end());
    // cout << a << endl;
    if (b.size() < 5)
    {
        for (int i = 0; i < a.size(); i++)
        {
            // cout << a[i] << endl;
            if (a[i] > b[0])
            {
                // cout << a[i] << endl;
                if (st[a[i]] >= b.size())
                {
                    cout << "YES" << endl;
                    return 0;
                }
            }
        }
    }
    else
    {
        for (int i = 0, j = 0; i < a.size(); i++)
        {
            int t = i;
            while (a[t] > b[j] && j < b.size())
            {
                if (a[t + 1] - a[t] != 1 && t - i < 4)
                {
                    break;
                }
                t++;
                j++;
            }
            if (j == 5)
            {
                cout << "YES" << endl;
                return 0;
            }
            else
            {
                j = 0;
            }
        }
    }
    cout << "NO" << endl;
    return 0;
}