-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA 393 - Nineteen.java
39 lines (32 loc) · 1.12 KB
/
A 393 - Nineteen.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
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String data = input.nextLine();
data = data.toLowerCase();
char [] simpan = data.toCharArray();
int countN = 0, countT = 0, countI = 0, countE = 0,end = 0;
for (int i = 0; i < simpan.length; i++) {
if (simpan[i] == 'n') {
countN++;
}
if (simpan[i] == 't') {
countT++;
}
if (simpan[i] == 'i') {
countI++;
}
if (simpan[i] == 'e') {
countE++;
}
}
while(countN >= 3 && countT >= 1 && countE >= 3 && countI >= 1 ){
end++;
countN -= 2;
countT -= 1;
countE -= 3;
countI -= 1;
}
System.out.println(end);
}
}