Daisy and the Transformation
Practice
3.5 (545 votes)
Ad Hoc
Ready
Approved
Easy
String
Problem
80% Success 5064 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Mack gives Daisy two strings S1 and S2-consisting only of characters- 'M' and 'D' , and asks her to convert S1 to S2 in exactly N moves.
In a single move, Daisy has two choices:
- Exchange any one 'M' with a 'D', or
- Exchange any one 'D' with a 'M'.
You need to help Daisy if it's possible to transform S1 to S2 in exactly N moves. Output "Yes" if possible, else "No".
Input Format:
First line contains T, the number of test cases. T lines follow.
Each line consists of 2 space separated strings S1 and S2, and and the value N.
Output Format:
For each test case, print the answer, either "Yes" or "No"-(Without the quotes).
Constraints:
1 ≤ T ≤ 250
1 ≤ |S1|=|S2| ≤ 50
1 ≤ N ≤ 100
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
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
24 votes
Tags:
Binary SearchAlgorithmsC++
Points:30
6 votes
Tags:
AlgorithmsBasic ProgrammingBasics of ImplementationImplementationMedium
Points:30
Tags:
HiringHiringHiringBasic ProgrammingImplementationEasyBasics of Implementation
Editorial
Login to unlock the editorial