Source Code
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define ll long long
const int  N =128;
int occ1[N],occ2[N];
int main() {
    IOS

    int t;cin>>t;
    while(t--){;
        int n;cin>>n;
        memset(occ1,0, sizeof(occ1));
        memset(occ2,0, sizeof(occ2));
        string a,b;cin>>a>>b;
        for(int i=0;i<n;i++)
            occ1[a[i]]++;
        for(int i=0;i<n;i++)
            occ2[b[i]]++;
        bool ch=true;
        for(int i=0;i<N;i++)
            if(occ1[i]!=occ2[i]) {
                ch = false;
                break;
            }
        cout<<(ch?"yes\n":"no\n");
    }

};
Copy
Moving Digits HusseinSaad
GNU G++17
2 ms
256 KB
Wrong Answer