what are these dots for ?
and how is my tactic to find the solution here? i try to use 2 for-loops to compare one word of the list with the next (i = 0 & j = i +1) is this approach useful, or is there a better way to do so?
thanks
package com.codegym.task.task22.task2209;
import java.util.*;
import java.io.*;
/*
Make a word chain
*/
public class Solution {
public static void main(String[] args) throws IOException {
// ...
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String[] strings = null;
while(reader.ready()){
strings = reader.readLine().split("\\s+");
}
getLine(strings);
StringBuilder result = getLine();
System.out.println(result.toString());
}
public static StringBuilder getLine(String... words) {
StringBuilder str = new StringBuilder();
for(int i = 0; i < words.length; i++){
String first = words[i];
str.append(words[0]);
for(int j = i+1; j < words.length; j++){
String second = words[j];
int n = first.length();
if(first.indexOf(n) == second.indexOf(0)){
str.append(words[j]);
break;
}
}
}
return str;
}
}