Playing with Strings
All submissions for this problem are available.### Read problems statements in [Hindi](http://www.codechef.com/download/translated/COOK108/hindi/PLAYSTR.pdf), [Mandarin Chinese](http://www.codechef.com/download/translated/COOK108/mandarin/PLAYSTR.pdf), [Russian](http://www.codechef.com/download/translated/COOK108/russian/PLAYSTR.pdf), [Vietnamese](http://www.codechef.com/download/translated/COOK108/vietnamese/PLAYSTR.pdf), and [Bengali](http://www.codechef.com/download/translated/COOK108/bengali/PLAYSTR.pdf) as well. Chef usually likes to play cricket, but now, he is bored of playing it too much, so he is trying new games with strings. Chef's friend Dustin gave him binary strings $S$ and $R$, each with length $N$, and told him to make them identical. However, unlike Dustin, Chef does not have any superpower and Dustin lets Chef perform only operations of one type: choose any pair of integers $(i, j)$ such that $1 \le i, j \le N$ and swap the $i$-th and $j$-th character of $S$. He may perform any number of operations (including zero). For Chef, this is much harder than cricket and he is asking for your help. Tell him whether it is possible to change the string $S$ to the target string $R$ only using operations of the given type. ### Input - The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows. - The first line of each test case contains a single integer $N$. - The second line contains a binary string $S$. - The third line contains a binary string $R$. ### Output For each test case, print a single line containing the string `"YES"` if it is possible to change $S$ to $R$ or `"NO"` if it is impossible (without quotes). ### Constraints - $1 \le T \le 400$ - $1 \le N \le 100$ - $|S| = |R| = N$ - $S$ and $R$ will consist of only '1' and '0' ### Example Input ``` 2 5 11000 01001 3 110 001 ``` ### Example Output ``` YES NO ``` ### Explanation **Example case 1:** Chef can perform one operation with $(i, j) = (1, 5)$. Then, $S$ will be "01001", which is equal to $R$. **Example case 2:** There is no sequence of operations which would make $S$ equal to $R$.
|Tags||basic-maths, cook108, ezio_26, frequency, taran_1407|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions