Under construction

Still being built. Things may change

Data Transmission

Time limit2sMemory limit1024 MB

Summary
Given two binary strings s and t, the task is to decide whether t equals s or differs from it by one swap of adjacent bits.
Level

Easy2 of 10

Topics
String, Implementation
Solved
No attempts yet

Problem

Data is sent from a transmitter to a receiver over a communication channel as a sequence of bits. The channel may distort the sequence during transmission, so the sequence tt received by the receiver can differ from the sequence ss sent by the transmitter. One type of distortion is the swap of two adjacent bits. In this case, ss and tt differ at exactly two adjacent positions ii and i+1i+1, where si=ti+1s_i = t_{i+1} and si+1=tis_{i+1} = t_i, and sj=tjs_j = t_j for every jj other than ii and i+1i+1.

You are a researcher working on information transmission. You are designing a coding scheme for an important government channel. The code must be able to correct one adjacent bit swap. To assess the channel's reliability, the test works as follows. Several bit sequences s1,s2,…,sns_1, s_2, \ldots, s_n are sent, the received sequences t1,t2,…,tnt_1, t_2, \ldots, t_n are stored, and then they are compared with what was sent. The reliability is judged by the fraction of sequences that arrived without distortion or with a single adjacent swap.

Comparing the sequences by hand is too laborious because they are long. Write a program that, given two sequences ss and tt, determines whether tt can be obtained from ss by performing at most one swap of adjacent symbols.

Input

The first line contains the sequence ss, and the second line contains the sequence tt. Both sequences are non-empty, consist only of 0 and 1, and have length at most 100000.

Output

Print YES if tt can be obtained from ss in the way described above. Otherwise, print NO.

Examples3

  1. Example 1

    Input
    0001010
    0010010
    
    Expected output
    YES
    
  2. Example 2

    Input
    0001010
    0010101
    
    Expected output
    NO
    
  3. Example 3

    Input
    0001010
    0001010
    
    Expected output
    YES