 New update is available. Click here to update.

# Similar Strings

Last Updated: 7 Jul, 2021
Difficulty: Ninja

## PROBLEM STATEMENT

#### Your task is to return the maximum and minimum difference of the three strings for all the possible rotations of string a.

##### For Example:
``````If the value of 'N' is 2, 'A' is "ab" , 'B' is "aa" and 'C' is "bb".
Then the answer for this input is
min = 2
max = 2

Because current difference is 1 + 1 = 2
After one rotation difference will be 1 + 1 = 2
Hence, the minimum and the maximum answer is 2.
``````
##### Input Format:
``````The first line contains a single integer 'T' denoting the number of test cases to be run. Then the test cases follow.

First line: Single integer 'N' (the length of the three strings)

Following three lines: Strings 'A, 'B', and 'C', respectively.
``````
##### Output Format:
``````For each test case, Print two space-separated integers denoting the maximum and minimum difference of the three strings for all possible rotations of string a.

Output for each test case will be printed in a separate line.
``````
##### Note
``````You are not required to print anything; it has already been taken care of. Just implement the function.
``````
##### Constraints:
``````1 <= T <= 50
1 <= N <= 10^4

Time Limit: 1 sec.
``````
SIMILAR PROBLEMS

Odd Even

Posted: 31 Oct, 2022
Difficulty: Easy

Ninja And The Strictly Increasing Array

Posted: 27 Nov, 2022
Difficulty: Moderate

Maximum GCD

Posted: 8 Dec, 2022
Difficulty: Hard

Prime?

Posted: 9 Dec, 2022
Difficulty: Easy

Co-Prime

Posted: 14 Dec, 2022
Difficulty: Hard