import java.util.Scanner; public class Main { public static void main(String[] args) { int x,y; String s; char ch[]; Scanner sc=new Scanner(System.in); System.out.println("Enter String :"); s=sc.nextLine(); ch = s.toCharArray(); for (x = 0; x < s.length(); x++) { for (y = x + 1; y < s.length(); y++) { if (ch[x] == ch[y]) { System.out.print(ch[y] + " "); break; } } } } }
Enter String : sateesh
s e