forked from ngthanhtrung23/CompetitiveProgramming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA.java
More file actions
63 lines (53 loc) · 1.59 KB
/
A.java
File metadata and controls
63 lines (53 loc) · 1.59 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
52
53
54
55
56
57
58
59
60
61
62
63
import java.io.*;
import java.math.*;
import java.util.*;
public class A {
public static void main(String[] args) {
try {
(new Solver()).go();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
class Solver {
public void go() {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
String a = "A" + in.next() + "A";
int nx = 0;
int[] x = new int[1011];
for(int i = 0; i < a.length(); i++)
if ("AEIOUY".indexOf(a.charAt(i)) >= 0) {
x[++nx] = i;
}
int res = 0;
for(int i = 2; i <= nx; i++)
res = Math.max(res, x[i] - x[i-1]);
System.out.println(res);
out.close();
}
}
class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
}