SHOW:
|
|
- or go back to the newest paste.
1 | a = input() | |
2 | b = input() | |
3 | x = [] | |
4 | y = [] | |
5 | - | for i in a: |
5 | + | count = [0] * (max(a) + 1) |
6 | - | x.append(i) |
6 | + | for elem in a: |
7 | - | for j in b: |
7 | + | count[elem] += 1 |
8 | - | y.append(j) |
8 | + | for i in range(len(count)): |
9 | - | if len(x) == len(y): |
9 | + | for j in range(count[i]): |
10 | x += i, end = ' ' | |
11 | count = [0] * (max(b) + 1) | |
12 | for elem in b: | |
13 | count[elem] += 1 | |
14 | for i in range(len(count)): | |
15 | for j in range(count[i]): | |
16 | y += i, end = ' ' | |
17 | if x == y: | |
18 | print('YES') | |
19 | else: | |
20 | print('NO') |