String S;
int L, i, j;
String W[];
boolean build;
void setup(){
// Initializations
S = “We are the world We are the children”;
L = S.length();
j = 0;
W = new String[100];
W[0] = “”;
// Main loop
for(i = 0; i < L; i++){
if(S.charAt(i) == ’ '){
if(build == true){
j++;
W[j] = “”;
build = false;
}
}
else{
W[j] = W[j] + S.charAt(i);
build = true;
}
}
if(build == true)
j++;
for(i = 0; i < j; i++)
println(W[i]);
println(j);
}
what else should I add to prevent the word “We are the world we are the children being duplicated?”
Do I have to use HashSet uniques = new HashSet();?