質問編集履歴
1
cordの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -17,3 +17,39 @@
|
|
17
17
|
hello → 新規単語なので配列に追加
|
18
18
|
|
19
19
|
the → 既存単語なので要素番号0をカウントアップし、2回目とカウント
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
```java
|
24
|
+
|
25
|
+
String word[] = new String[10000];
|
26
|
+
|
27
|
+
int num[] = new int[10000];
|
28
|
+
|
29
|
+
int i = 0;
|
30
|
+
|
31
|
+
int count = 0;
|
32
|
+
|
33
|
+
String line = null;
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
Scanner pref = new Scanner(System.in);
|
38
|
+
|
39
|
+
line = pref.next();
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
while(line != ""){
|
44
|
+
|
45
|
+
if(word.equals(line)){
|
46
|
+
|
47
|
+
num[i] = count + 1;
|
48
|
+
|
49
|
+
System.out.println( word + "は" + num[i] + "回");
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
}
|
54
|
+
|
55
|
+
```
|