300983: CF186A. Comparing Strings

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Comparing Strings

题意翻译

如果我们能够在第一个字符串中交换两个字符并且获得第二个字符串,那么输出“YES”,否则输出“NO”。 Translated by @蒟蒻wyx

题目描述

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.

输入输出格式

输入格式


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.

输出格式


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

输入输出样例

输入样例 #1

ab
ba

输出样例 #1

YES

输入样例 #2

aa
ab

输出样例 #2

NO

说明

- 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

题意翻译

如果我们能够在第一个字符串中交换两个字符并且获得第二个字符串,那么输出“YES”,否则输出“NO”。 Translated by @蒟蒻wyx

加入题单

算法标签: