[SOLVED] String Comparison

10.00 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

Rate this product

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:

  • if string1 equals to string2.
  • if string1 is lexicographically smaller than string2
  • if string2 is lexicographically smaller than string1.

The strings contain only uppercase and lowercase Latin letters.

 

Input

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 aAaAAA

 

Sample Output 1

0

 

Sample Input 2 zAz zAd

 

Sample Output 2

2

 

Sample Input 3 aBcDeF FeDaBc

 

Sample Output 3

1

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.