Arrange characters in a string

A string of characters including only alphabets (lowercase letters) is provided as an
input.
The first task is to compute the frequency of each character appearing in the
string. In the output, the characters have to be arranged in the same order as
they appear in the input string.
Then characters have to be rearranged, such that all the characters having a
specific frequency, say , come together.
Let the frequency of a character, lying in between the two characters having same
frequency ,x be . The steps to be followed for getting the desired arrangement
are as follows:
If y > x, then shift the character at the end.
If y<xthen shift the character at the beginning.
Sample Input:
nomatterhowbusyyoumaythinkyouareyoumustfindtimeforreadingorsurrenderyourself
toselfchosenignorance
3
3 1 6
n 8 o 11 m 4 a 5 t 6 e 10 r 10 h 3 w 1 b 1 u 7 s 6 y 6 i 5 k 1 f 4 d 3
g 2 l 2 c 2
k 1 b 1 w 1 n 8 o 11 m 4 a 5 t 6 e 10 r 10 h 3 d 3 g 2 l 2 c 2 u 7 s 6
y 6 i 5 f 4
k 1 b 1 w 1 n 8 o 11 m 4 a 5 t 6 e 10 r 10 h 3 d 3 g 2 l 2 c 2 u 7 s 6
y 6 i 5 f 4
c 2 l 2 g 2 d 3 h 3 k 1 b 1 w 1 n 8 o 11 m 4 a 5 t 6 s 6 y 6 i 5 f 4 e
10 r 10 u 7
give some hint for 2nd output in which characters having samefrequency come together

@shrutikatyal i am not getting the output format clearly,can you give me problem link.

i dont have link can you pls give me your mail id

check your inbox in chats.

you have recieved my mail? pls reply to this question soon

i have send you pdf document at [email protected]

have you tried using brute force here.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.