-
Notifications
You must be signed in to change notification settings - Fork 0
/
P154.java
92 lines (51 loc) · 1.66 KB
/
P154.java
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package aceptaelreto;
import java.util.*;
public class P154 {
static Scanner s;
static boolean cas() {
char c1, c2, c3;
String l, r;
int n;
n = s.nextInt();
l = s.next();
if (n == 9999 && l.equals("ZZZ")) {
return false;
}
if (n == 9999) {
c3 = l.charAt(2);
if (c3 == 'Z') {
c2 = l.charAt(1);
if (c2 == 'Z') {
c1 = l.charAt(0);
c1++;
if (c1 == 'E' || c1 == 'I' || c1 == 'O' || c1 == 'U') {
c1++;
}
r = c1 + "BB" ;
System.out.printf("0000 %s\n", r);
} else {
c2++;
if (c2 == 'E' || c2 == 'I' || c2 == 'O' || c2 == 'U') {
c2++;
}
r = l.substring(0, 1) + c2 + 'B';
System.out.printf("0000 %s\n", r);
}
} else {
c3++;
if (c3 == 'E' || c3 == 'I' || c3 == 'O' || c3 == 'U') {
c3++;
}
r = l.substring(0, 2) + c3;
System.out.printf("0000 %s\n", r);
}
} else {
System.out.printf("%04d %s\n", n + 1, l);
}
return true;
}
public static void main(String[] args) {
s = new Scanner(System.in);
while (cas());
}
}