Computer Science, asked by SangeethSankar, 11 months ago

Which is the function to display a group of characters in java

Answers

Answered by adarsh2512
0

Answer:

Group all occurrences of characters according to first appearance

Given a string of lowercase characters, the task is to print the string in a manner such that a character comes first in string displays first with all its occurrences in string.

Examples:

Input : str = "geeksforgeeks"

Output: ggeeeekkssfor

Explanation: In the given string 'g' comes first

and occurs 2 times so it is printed first

Then 'e' comes in this string and 4 times so

it gets printed. Similarly remaining string is

printed.

Input : str = "occurrence"

output : occcurreen

Input : str = "cdab"

Output : cdab

Similar questions