Untitled
raw download clone
TEXT
views 52
,
size 768 b
#include <stdio.h>
#include <string.h>




char a[100005];
char b[100005];




int compare(int l, int r, int L, int R){
    int i, mid, MID;
    mid = (l+r)/2;
    MID = (L+R)/2;
     
    for(i=0;i<r;i++){
        if(a[i]==b[i]) return 1;
    }
    if((r-l+1)%2==1) return 0;
    else{
        if(compare(l, mid, L, MID) && compare(mid+1, r, MID+1, R)) return 1;
        else if(compare(l, mid, MID+1, R) && compare(mid+1, r, L, MID)) return 1;
        else return 0;
    }
}




int main(void)
{
    int r, R;
    scanf("%s%s", a ,b);
    
    r = strlen(a)-1;
    R = strlen(b)-1;
    
    if(compare(0,r,0,R)) printf("YES\n");
    else printf("NO\n");
    return 0;
}
close fullscreen
Login or Register to edit or fork this paste. It's free.