I am trying to find the longest consecutive digits from a string of digits. For example, given:
"12233344445"
I expect to return:
"4444"
I can find that using iteration, but I think that using regex would be cool although it's not efficient. It should be simple but I can't do it. Please enlighten me. I use Ruby, but any language will do.