String Comparison solution


Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment


5/5 - (2 votes)

String Comparison
Problem Description
Given 2 strings of the same size, determine which string is lexicographically smaller. In this
problem, you can assume that the letter’s case does not matter, i.e. the uppercase letter is the same as
the corresponding lowercase letter. Output:
0 if string1 equals to string2.
1 if string1 is lexicographically smaller than string2
2 if string2 is lexicographically smaller than string1.
The strings contain only uppercase and lowercase Latin letters.
The first line of the input contains string1.
The second line of the input contains string2.
The length of both strings does not exist 100. (1 <= |string1|, |string2| <= 100). Output Output 0, 1, or 2 based on the comparison described above. Sample Input 1 aAa AAA Sample Output 1 0 Sample Input 2 zAz zAd Sample Output 2 2 Sample Input 3 aBcDeF FeDaBc Sample Output 3 1