I need to find repeated words on a string, and then count how many times they were repeated. So basically, if the input string is this:
String s = \"House, House
public static void main(String[] args){ String string = "elamparuthi, elam, elamparuthi"; String[] s = string.replace(" ", "").split(","); String[] op; String ops = ""; for(int i=0; i<=s.length-1; i++){ if(!ops.contains(s[i]+"")){ if(ops != "")ops+=", "; ops+=s[i]; } } System.out.println(ops); }