i need to represent a String in the form of a regular expression in java. I need to somehow analyse the letters of the string and produce the expression representing that string.
For example if i have the string: abababab , i need to output (ab)*
another example if i have the string: aaaaab, i need to output (a)*b
Could anyone please advise.