-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWords.java
More file actions
30 lines (25 loc) · 819 Bytes
/
Copy pathWords.java
File metadata and controls
30 lines (25 loc) · 819 Bytes
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
// TODO: Wrong answers
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.ArrayList;
public class Words{
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
ArrayList<String> words = new ArrayList<>();
while((line = br.readLine()) != null){
System.out.println(line);
StringTokenizer st = new StringTokenizer(line);
while(st.hasMoreTokens())
words.add(st.nextToken());
}
br.close();
for(int i = 0; i < words.size(); i++)
for(int j = 0; j < words.size(); j++){
if(i == j) continue;
System.out.println(words.get(i) + words.get(j));
}
}
}