#K39262. Rearrange Digits

    ID: 26382 Type: Default 1000ms 256MiB

Rearrange Digits

Rearrange Digits

You are given two integers A and B. Your task is to determine whether the digits of A can be rearranged to form B. In other words, check if some permutation of the digits in A is exactly the sequence of digits in B. For example, 123 can be rearranged to form 321 (but not 456).

Note: Both numbers are given without leading zeros, and you should compare the sorted digits of the two numbers.

inputFormat

A single line containing two integers A and B separated by space.

outputFormat

Output a single integer: 1 if the digits of A can be rearranged to form B, otherwise 0.## sample

123 321
1

</p>