Write a program to create the summary word from the given sentence. The summary word should contain all the letters which occurred in the given sentence and they should be in alphabetical order. The case of the first occurrence of the letter should be included. Assume that the sentence only contains alphabets and spaces.
Input (String) | Output (String) |
---|---|
Hello How are you | aeHloruwy |
I love my mom | eIlmovy |
Indians love cricket | acdeIklnorstv |
Merit Campus | aCeiMprstu |
class CreateSummaryWord
{ public static void main(String s[])
{
String sentence = "Hello How are you";
System.out.println("The summary word is " + createSummaryWord(sentence));
}
public static String createSummaryWord(String sentence) {
//Write code here to create the summary word as per the requirements described above
}
}
Topic: Java Character Class