Untitled

 avatar
unknown
plain_text
a year ago
953 B
4
Indexable
#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;
}
Editor is loading...
Leave a Comment