Thursday , 21 February 2019
Home » Class 10 » Program to Remove Duplicate Characters from a Word

Program to Remove Duplicate Characters from a Word


Write a program to input a word from the user and remove the duplicate characters present in it.


INPUT – abcabcabc
OUTPUT – abc

INPUT – javaforschool
OUTPUT – javforschl

INPUT – Mississippi

Programming Code:

* The class RemoveDupChar inputs a word and removes duplicate characters
* @author :
* @Program Type : BlueJ Program – Java

class RemoveDupChar
public static void main(String args[])throws IOException
BufferedReader br = new BufferedReader(new InputStreamReader(;
System.out.print(“Enter any word : “);
String s = br.readLine();
int l = s.length();
char ch;
String ans=””;

for(int i=0; i


Example 1:
Enter any word : Mississippi
Word after removing duplicate characters : Misp

Example 2:
Enter any word : Attitude
Word after removing duplicate characters : Atiude

Check Also

Infix Postfix Prefix Conversion – Correct Method (ISC Computer Science)

In this video we discuss about the correct way of converting an Infix Expression to Postfix and Prefix.


  1. Its just too good. Thanks for providing such a good explanation. Just loving this site.☺??

  2. Thannxx.. A greatt site.. Jusst loviingg iiiitt..

Leave a Reply

Your email address will not be published. Required fields are marked *