import java util Scanner public class Task046 public static void main

 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
import java.util.Scanner;
public class Task046 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String a = scanner.nextLine();
String b = scanner.nextLine();
String s1 = a.toLowerCase();
String s2 = b.toLowerCase();
if (s1.length() >= s2.length()) {
boolean pr = true;
for (int i = 0; i < s2.length() && pr; i++) {
if (s1.charAt(i) < s2.charAt(i)) {
System.out.println("Первая");
pr = false;
}
if (s1.charAt(i) > s2.charAt(i)) {
System.out.println("Вторая");
pr = false;
}
}
if (pr) {
if (s1.length() == s2.length()) {
System.out.println("Вторая");
} else {
System.out.println("Строки одинаковы");
}
}
} else {
boolean pr = true;
for (int i = 0; i < s1.length() && pr; i++) {
if (s1.charAt(i) < s2.charAt(i)) {
System.out.println("Первая");
pr = false;
}
if (s1.charAt(i) > s2.charAt(i)) {
System.out.println("Вторая");
pr = false;
}
}
if (pr) {
System.out.println("Первая");
}
}
}
}