Codeforces Round 118 (Div. 2)
A
Comparing Strings
Codeforces
1100
原题
←B →
翻译中…

Some dwarves that are finishing the StUDY (State University for Dwarven Youngsters) Bachelor courses, have been told "no genome, no degree". That means that all dwarves should write a thesis on genome. Dwarven genome is far from simple. It is represented by a string that consists of lowercase Latin letters.

翻译中…

Dwarf Misha has already chosen the subject for his thesis: determining by two dwarven genomes, whether they belong to the same race. Two dwarves belong to the same race if we can swap two characters in the first dwarf's genome and get the second dwarf's genome as a result. Help Dwarf Misha and find out whether two gnomes belong to the same race or not.

翻译中…

Input

翻译中…

The first line contains the first dwarf's genome: a non-empty string, consisting of lowercase Latin letters.

翻译中…

The second line contains the second dwarf's genome: a non-empty string, consisting of lowercase Latin letters.

翻译中…

The number of letters in each genome doesn't exceed $10^{5}$. It is guaranteed that the strings that correspond to the genomes are different. The given genomes may have different length.

翻译中…

Output

翻译中…

Print "YES", if the dwarves belong to the same race. Otherwise, print "NO".

翻译中…

Note

翻译中…
  • First example: you can simply swap two letters in string "ab". So we get "ba".
  • Second example: we can't change string "aa" into string "ab", because "aa" does not contain letter "b".
翻译中…

样例

Input #1
ab
ba
Output #1
YES
InputCopy OutputCopy
Input #2
aa
ab
Output #2
NO
InputCopy OutputCopy
题目信息
题号
186A
时间限制
2 s
内存限制
256 MB
标签
模拟
字符串

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。