Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

aabccdee
Find the used alphabets as abcde ?

Answer Posted / hitesh

public static void main(String[] args) {

String s1 = "aaabbccccaaa";
String s2 = " ";
for (int i = 0; i < s1.length(); i++) {
if (i == 0) {
s2 = s2.concat("" + (s1.charAt(i)));
}

if (s2.contains(s1.charAt(i) + "")) {
continue;
} else {
s2 = s2.concat("" + (s1.charAt(i)));
}
}
System.out.println(s2);
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you sort data in java?

1005


How to calculate the length of a singly linked list in java?

1092


How to create a thread in java?

1197


What do you mean by of string::valueof expression in java 8?

1007


How much is a java license?

987


What is the purpose of finalization in java programming?

1073


What is a stringbuilder?

981


Where will it be used?

1993


What is main function purpose?

1081


Define how does a try statement determine which catch clause should be used to handle an exception?

1256


What is tochararray in java?

994


What is difference between jdk,jre and jvm?

1187


What is arraylist e?

1147


What is dynamic array in java?

1080


How does finally block differ from finalize() method?

1109