Compare two strings case-insensitively and output their lexicographic relationship.
Problem
You are given two strings of the same length. Compare them ignoring case and determine their lexicographic order.
- If the first string is lexicographically smaller, print
-1. - If the second string is lexicographically smaller, print
1. - If they are equal, print
0.
The comparison is made after converting both strings to the same case. In this problem, think of lowercase letters as being equal to their uppercase counterparts.
Notes
- The strings contain only English letters.
- Comparison is performed character by character from left to right.
- The first differing character decides the answer.
Input Format
- One line containing the first string
s. - One line containing the second string
t.
Output Format
Print one integer:
-1ifs < t1ifs > t0ifs = t
The comparison is case-insensitive.
Constraints
1 <= |s|, |t| <= 100|s| = |t|sandtconsist only of Latin letters.
Example 1
Input
aaaa AAAA
Output
0
Explanation
After ignoring case, both strings are identical.
Example 2
Input
abcdef ABCDEF
Output
0
Explanation
The strings are equal when compared case-insensitively.
Show 1 more example
Example 3
Input
aaaa zzzz
Output
-1
Explanation
At the first position, a comes before z.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.