Program to print Duplicate words in the String
import [Link].*; //Importing packages
import [Link].*;
import [Link].*;
public class Duplicate //declaring class
{ //opening braces of class
public static void main(String[] args) //declaring main method
{ //opening braces of main method
Scanner pa = new Scanner([Link]); //declaring Scanner class
[Link]("Enter a string: ");
String s = [Link]().toLowerCase()+" "; //Store the String and convert it into LowerCase
int e; //To store index of space
for(int i=0;i<[Link]();i+=e) //loop till length of string
e = [Link](' ',i); //storing index of Space
String w = [Link](i,e); //storing word between i and e
int d = [Link](w, e + 1); //to check if word is repeated
if (d>0) //if the word is more than one time in the string
[Link](w); //To print the word
} //closing braces of main method
} //closing braces of class
VARIABLE DATA TYPE FUNCTION
s String To store the String
e Character To store the index of space
i Integer To store the index of the first character
of the word
w Integer To Store the word
d Integer To Count the frequency of Each word