Close
Topic list
HARD
45 mins
Strings
Topics (Covered in this problem)
Problem solved
Skill meter
Strings
-
-
Other topics
Problem solved
Skill meter
Matrices (2D Arrays)
-
-
-
-
Sorting
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
Arrays
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

Contributed by
Vivek Kumar Mehta
Hard
0/120
Avg time to solve 45 mins
Success Rate 55 %
Share

## Problem Statement

#### Help Ninja to find if he can change his string 'K' to string 'S', which Mico likes.

##### Note:
``````Both 'S' and 'K' contain only lowercase English characters.
``````
##### For Example:
``````K = "aabb" and S = "bbcc"
Now Ninja can do the following changes:
- Change ‘b’ to ‘c’ -> “aacc”
- Change ‘a’ to ‘b’ -> “bbcc”

Hence Ninja can give Mico the desired gift.
``````
Detailed explanation ( Input/output format, Notes, Constraints, Images )
##### Sample Input 1:
``````2
aabcc
ccdaa
ninjas
coding
``````
##### Sample Output 1:
``````True
False
``````
##### Explanation For Sample Output 1:
``````Test case 1:

Here K=ccdaa and S=aabcc. Here we can change K into S by following conversions

Change ‘d’ to ‘b’ -> ccbaa

Change ‘a’ to ‘e’ -> ccbee

Change ‘c’ to ‘a’ -> aabee

Change ‘e’ to ‘c’-> aabcc

Test case 2:

It is not possible to change K to S by any number of conversions.
``````
##### Sample Input 2
``````2
code
dope
acbz
acbza
``````
##### Sample Output 2
``````True
False
``````
Auto
Console