#K15526. Rearrange to Match

    ID: 24376 Type: Default 1000ms 256MiB

Rearrange to Match

Rearrange to Match

Given two binary strings s and t each of length n, determine if it is possible to rearrange t such that it becomes exactly equal to s. Rearranging means permuting the characters of t in any order. The necessary and sufficient condition for such a rearrangement is that both strings have the same count of '0' and '1'. Output Yes if the rearrangement is possible; otherwise, output No.

inputFormat

The input is given on three separate lines:

  1. The first line contains a single integer n, the length of the binary strings.
  2. The second line contains the binary string s.
  3. The third line contains the binary string t.

outputFormat

Output a single line containing Yes if t can be rearranged to match s, and No otherwise.

## sample
4
1100
0011
Yes

</p>