405052: GYM101755 E Substring Reverse
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
E. Substring Reversetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output
Two strings s and t of the same length are given. Determine whether it is possible to make t from s using exactly one reverse of some its substring.
InputThe first line contains the string s, and the second — the string t. Both strings have the same length from 1 to 200000 characters and consist of lowercase Latin letters.
OutputOutput «YES», if it is possible to reverse some substring of s to make s equal to t, and «NO», otherwise.
ExamplesInputabcdefgOutput
abedcfg
YESInput
abcdefgOutput
abdecfg
NO