Problem Statement
There are given two strings \(S\) and \(T\) consisting of lowercase English letters, both of same length. Let’s say length of both strings is \(N\).
Is it possible to make both strings equal by doing following changes any number of times :
- Choose any index \(i (0 \leq i < n)\) and swap \(S_i\) and \(T_i\)
- Choose any index \(i (0 \leq i < n)\) and swap \(S_i\) and \(S_{n-i-1}\)
- Choose any index \(i (0 \leq i < n)\) and swap \(T_i\) and \(T_{n-i-1}\)
Input Format
First line contains a String \(S\).
Second line contains a String \(T\).
Output Format
Print “\(YES\)” (without quotes) if you can make \(S\) and \(T\) equal . Else print “\(NO\)” (without quotes) .
Constraints
\(1 \leq N \leq 10^5\).
You can swap S(0) and S(4) . You can swap S(1) and S(3) for getting both strings equal .
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor