Data transfering
The data is transmitted from the transmitter to the receiver via a communication channel in the form of a bit sequence. Features of the communication channel are such that during the transmission of a sequence of bits, some distortions may be introduced into it. Thus, the bit sequence t received by the receiver may be different from the s sequence transmitted by the transmitter. One of the types of distortion that can be introduced during the transmission is the so-called transposition of neighboring bits. With this distortion, s and t differ exactly in two adjacent positions i and i + 1, with s[i]
= t[i +1]
, s[i + 1]
= t[i]
, and for all j ≠ i, j ≠ i + 1 the equality s[i]
= t[i]
is true.
You are one of the researchers dealing with problems of information transfer. Currently you are working on a coding system for an important government communication channel. The code you develop must have the property of correcting one transposition of neighboring bits. In order for the code being developed to be as efficient as possible, you need to obtain information about the reliability level of this channel. Reliability is tested in the following way: the sequence of bits s[1]
, s[2]
, ..., s[n]
is transmitted over the channel, the sequence t[1]
, t[2]
, ..., t[n]
that was received by the receiver is remembered, and then compared with transmitted. Based on how much of the sequence is transmitted without distortion or with a single transposition, the conclusion is made about the reliability of the channel.
Since the sequence selected for transmission is long enough, it is very laborious to perform their comparison manually. So you decided to write a program that performs this comparison.
Write a program that, according to two given sequences s and t, determines whether it is possible to get t from s by performing at most one transposition of neighboring characters.
Input
First line contains the sequence s, second line contains the sequence t. Both sequences are non-empty, containing only zeros and ones, and have length no more than 10^5
.
Output
If the sequence t can be obtained from the sequence s in the specified way, print YES, otherwise print NO.