less than 1 minute read

You are given two lowercase alphabet strings s and t, both of them the same length. You can pick one character in s and another in t and swap them. Given you can make unlimited number of swaps, return whether it’s possible to make the two strings equal.

Constraints

  • n ≤ 100,000 where n is the length of s and t

https://binarysearch.com/problems/Swap-Characters-to-Equalize-Strings

Examples

Example 1

Input

  • s = ab
  • t = ba

Output

  • answer = True

Example 2

Input

  • s = aa
  • t = aa

Output

  • answer = True

Solution

Leave a comment