#C4637. Strict Anagram Check

    ID: 48197 Type: Default 1000ms 256MiB

Strict Anagram Check

Strict Anagram Check

Given two strings s1 and s2, determine if they are strict anagrams. Two strings are considered strict anagrams if:

  • Their sorted characters are the same (i.e. they are anagrams),
  • The strings are different, and
  • There exist exactly two indices i and j (with i ≠ j) such that swapping the characters s1[i] and s1[j] would make s1 identical to s2.

This condition mathematically can be represented as: $$ \text{if } s1[i]=s2[j] \text{ and } s1[j]=s2[i] \text{ for the only two indices where } s1 \neq s2 $$

If any of these conditions do not hold, the answer is False. Otherwise, it is True.

inputFormat

The input consists of two lines. The first line contains the string s1 and the second line contains the string s2.

outputFormat

Output a single line, either True or False, denoting whether the given strings are strict anagrams.

## sample
ab
ba
True