#abc221b. B - typo
B - typo
Score : points
问题描述
给定两个字符串 和 。确定是否可以通过最多进行一次以下操作使 和 相等:
- 在 中选择两个相邻的字符并交换它们。
请注意,允许选择不执行此操作。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given two strings and . Determine whether it is possible to make and equal by doing the following operation at most once:
- choose two adjacent characters in and swap them.
Note that it is allowed to choose not to do the operation.
Constraints
- Each of and is a string of length between and (inclusive) consisting of lowercase English letters.
- and have the same length.
Input
Input is given from Standard Input in the following format:
Output
If it is possible to make and 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 -nd and -rd characters of to make and equal.
Sample Input 2
aabb
bbaa
Sample Output 2
No
There is no way to do the operation to make and equal.
Sample Input 3
abcde
abcde
Sample Output 3
Yes
and are already equal.
update @ 2024/3/10 09:44:40
相关
在下列比赛中: