Group all possible repeated characters with a regex
I'm doing some code practice in hackerrank and I got the necessity to group all the possible combinations from a defined char or characters. i.e.
we have the array
index string
e
b
c
aa
r
y
and I have the word caaab then I need to have 2 groups as the array is defining at index 3 the combination aa I should have the group1: caaab and group 2: caaab so the middle a is being part of both groups but I have been unable to do it, I'm using kotlin or Java so do really appreciate to get a hand from...