Skip to main content

Posts

Showing posts from February 6, 2014

FINDING MISSING ELEMENTS IN A STRING

import java.io.*; import java.lang.*; class Misord { public static void main(String args[])throws IOException { check chk= new check(); String str1=chk.input(); String str4=chk.ord(str1); chk.mis(str4); } } class check { public String input()throws IOException { String x = " "; System.out.println("Enter the String"); DataInputStream in = new DataInputStream(System.in); x= in.readLine(); return(x); } public String ord(String str1) { char ch=' '; String str2=str1; String str3=" "; int l=str2.length(); int i,j; for(i=65;i<=90;i++) { for(j=0;j<=l-1;j++) { ch = str2.charAt(j); { if(((int)ch==i)||((int)ch==i+32))//change here has been done { str3=str3+ch; str3=str3.trim(); } } } } System.out.println(str3); return(str3); } public void mis(String str4) { String str5=str4.trim(); String s1=" "; int i=0,j=0,f=0,p=0; int l=str5.length(); System.out.println(l); for(i=65;i<90;i++) { p=0;