-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathFoobar.java
More file actions
57 lines (41 loc) · 1.12 KB
/
Foobar.java
File metadata and controls
57 lines (41 loc) · 1.12 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
import java.util.Scanner;
public class foobar {
public static int occ(char charac , String word ){
int x =0;
int i=0;
while (i<word.length()){
if (word.charAt(i)== charac){
x=x+1;}
i=i+1;
}
return x;}
public static void foo(){
Scanner t = new Scanner(System.in);
int num = t.nextInt();
t.nextLine();
int[] list = new int[5];
for(int d=0;d<num;d=d+1){
String word = t.nextLine();
int f = occ('f',word);
list[0]=f;
int o = (occ('o',word));
o = o/2;
list[1]=o;
int b = occ('b',word);
list[2]=b;
int a = occ('a',word);
list[3]=a;
int r = occ('r',word);
list[4]=r;
int min=list[0];
for (int j=0;j<5;j=j+1){
if (min > list[j]){
min = list[j];}
}
System.out.println(min);
}
}
public static void main(String[] args){
foo();
}
}