#abc221b. B - typo

B - typo

Score : 200200 points

问题描述

给定两个字符串 SSTT。确定是否可以通过最多进行一次以下操作使 SSTT 相等:

  • SS 中选择两个相邻的字符并交换它们。

请注意,允许选择不执行此操作。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given two strings SS and TT. Determine whether it is possible to make SS and TT equal by doing the following operation at most once:

  • choose two adjacent characters in SS and swap them.

Note that it is allowed to choose not to do the operation.

Constraints

  • Each of SS and TT is a string of length between 22 and 100100 (inclusive) consisting of lowercase English letters.
  • SS and TT have the same length.

Input

Input is given from Standard Input in the following format:

SS

TT

Output

If it is possible to make SS and TT equal by doing the operation in Problem Statement at most once, print Yes; otherwise, print No.

Sample Input 1

abc
acb

Sample Output 1

Yes

You can swap the 22-nd and 33-rd characters of SS to make SS and TT equal.

Sample Input 2

aabb
bbaa

Sample Output 2

No

There is no way to do the operation to make SS and TT equal.

Sample Input 3

abcde
abcde

Sample Output 3

Yes

SS and TT are already equal.

update @ 2024/3/10 09:44:40