ACM (TJU) : 2782


#include <iostream>
#include <cstdio>
#include <cctype>
using namespace std;

int main ()
{
    int testCase;
    cin >> testCase;

    while ( testCase-- ) {

        char a [80];
        char b [80];

        cin >> a >> b;

        int frq [30];

        for ( int i = 0; i < 30; i++ )
        frq [i] = 0;

        for ( unsigned int i = 0; i < strlen (a); i++ ) {
            a [i] = tolower (a[i]);
            frq [a [i]-97]++;
        }

        for ( unsigned int i = 0; i < strlen (b); i++ ) {
            b [i] = tolower (b[i]);
            frq [b[i]- 97]--;
        }

        bool flag = true;

        for ( int i = 0; i < 30; i++ ) {
            if ( frq [i] != 0 ) {
                flag = false;
                break;
            }
        }

        if ( flag )
        cout << "Yes" << endl;
        else
        cout << "No" << endl;

    }

    return 0;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s