All Tracks Basic Programming Implementation Basics of Implementation Problem

Monk and Digital World
Tag(s):

Easy, easy, strings

Problem
Editorial
Analytics

After doing a lot of hardwork, Monk has finally reached to the second checkpoint. He became such an awesome programmer that he found a way to enter into the Digital World.
While observing the beauty of the new world, he saw two strings $$A$$ and $$B$$ of same length $$N$$, fighting with each other. String $$A$$ has the power to take any two characters of its own and swap them, and can perform this swap operation any number of times. Monk being curious, wants to know whether String $$A$$ can convert itself into String $$B$$ using swap operations.

INPUT:
First line of input will consists of integer $$N$$. Next line will consists of $$N$$ lowercase English alphabets('a'-'z') denoting string $$A$$. Next line will consists of $$N$$ lowercase English alphabets('a'-'z') denoting string $$B$$.

OUTPUT:
Print "YES" (without quotes), if String $$A$$ can convert itself to string $$B$$ using this swap operation any number of times, else print "NO" (without quotes).

CONSTRAINTS:
1 ≤ N ≤ 1000

SAMPLE INPUT
4
abcd
bcda
SAMPLE OUTPUT
YES
Explanation

String $$A$$ ("abcd") can convert itself to String $$B$$ ("bcda") using sequence of swap operations.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic, Kotlin

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

HackerEarth

Challenge Name

CodeMonk (Checkpoint - II)

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications