Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
953 B
2
Indexable
Never
#include <iostream>
#include <string>
using namespace std;
int main()
{
    /*
    string str;
    std::getline(cin, str);
    int h = 0;
    int u = 0;
    while (h < str.size()) {
        if (str[h] == 32) {
            u++;
        }
        h++;
    }
    cout << u;
    return 0;
    */

    string a, b;
    cin >> a >> b;
    int a1, b1;
    a1 = 0;
    b1 = 0;
    int i = 0;
    while (a1 < a.size())
    {
        while (b1 < b.size())
        {
            if (a[a1] == b[b1])
            {
                while (a1 < a.size())
                {
                    if (a[a1] == b[b1]) {
                        a[a1] = ' ';
                        break;
                    }
                }
                i++;
            }
            b1++;
        }
        a1++;
    }
    if (i == b.size()) {
        cout << "YES";
    }
    else {
        cout << "NO";
    }
    return 0;
}
Leave a Comment