DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
How To Read The Words That Are Repeated?
// Reads & reports the number of words that are repeated in the sentence!
public class stutter
{
public static void main (String[] args)
{
String str = " ";
String[] words = str.split (" ");
for (int i=0; i<words.length; i++)
{
if(words[i].equals(words[i-1])) //Stuttered
System.out.println (words[i]);
}
}
}




