-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Petya_and_Strings.java
More file actions
51 lines (41 loc) · 1.25 KB
/
Copy pathA_Petya_and_Strings.java
File metadata and controls
51 lines (41 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import java.util.Scanner;
/**
* A_Petya_and_Strings
*/
public class A_Petya_and_Strings {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
String a = sc.nextLine();
String b = sc.nextLine();
boolean z = false;
if(a.length() == b.length())
{
String low1 = a.toLowerCase();
String low2 = b.toLowerCase();
for (int i = 0; i < a.length(); i++)
{
if(low1.charAt(i) == low2.charAt(i))
{
z = true;
}
else if(low1.charAt(i) > low2.charAt(i))
{
z = false;
System.out.println(1);
break;
}
else if(low1.charAt(i) < low2.charAt(i))
{
z = false;
System.out.println(-1);
break;
}
}
}
if(z)
{
System.out.println(0);
}
sc.close();
}
}