This is a homework assignment. I am trying to find a way to convert this code to do the same thing with regex. I can only use the split, matches, and replaceAll regex methods along with length(), indexOf, charAt. contains, substring, replace and equals. What I want is basically if there is a
string "cccaaaadddc" the result to get would be c3a4d3c1. The code below does it, but I need to find a way to add regex into it to do the same function. I can only use a single loop, nested is fine. I can only use these regex symbols:
.
*
+
\
[]
^
{n} or {n, } or {n-m}