How can you sort the following word by the given rule?
Example data is saapas which I want to be either
aaapss
or in the array
s
a
a
p
a
s
and then somehow
a
a
a
p
s
s
The function arsort with sort_flags SORT_REQULAR and SORT_STRING did not work for me.