
The character of every string of ‘STR1’ is strictly less than every character of every string of ‘STR2’ and vice versa.
‘STR1’ and ‘STR2’ only differ in one distinct character.
The first line contains an integer 'T' which denotes the number of test cases or queries to be run.
The first line of each test case contains two strings ‘STR1’ and ‘STR2’, representing both the strings.
For each test case, print a single line as the minimum number of characters needed to be changed.
The output of each test case will be printed in a separate line.
You do not need to print anything; it has already been taken care of. Just implement the given function.
1 <= T <= 5
1 <= |STR1|, |STR2| <= 5000
Where ‘T’ represents the number of test cases and ‘STR1’ represents the given first string and ‘STR2’ represents the given second string.
Time Limit: 1 second
The idea here is to count the number of steps required to make all characters of ‘STR2’ strictly greater than ‘STR1’ and vice versa and also to count the number of steps required to satisfy rule ‘2’ i.e ‘STR1’ and ‘STR2’ only differ by one distinct character and after that, we return the minimum number of steps required from both the condition.