CodingBat wordAppend Solution

public String wordAppend(String[] strings) {
  String res="";
  Map<String, Integer> map=new HashMap<String, Integer>();
  for(int i=0;i<strings.length;i++)
  if(map.get(strings[i])==null) map.put(strings[i],1);
  else if (map.get(strings[i])%2==1) {res+=strings[i];
  map.remove(strings[i]);}
  return res;
}

Comments