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

What is try-with-resources in java?

1178


If a class is declared without any access modifiers, where can the class be accessed?

1067


Is vector synchronized in java?

1010


What is append function?

1008


What does i ++ mean in Java?

961


Why are arrays useful in java?

1039


When do you get classcastexception?

1036


Is list thread safe in java?

929


What is the byte order of byte buffer?

1024


Explain thread life cycle in java?

1043


explain local datetime api in java8?

1021


How to change the priority of thread or how to set the priority of thread?

1041


What is sortedmap in java?

1038


How do you implement polymorphism in our day to day life?

3235


What are parsing rules?

996