how can we get the maximum number of letters that are side-by-side?
For example, if we count every side by side maximum letters a:
"Muhahaha, hello world!!!!! Aaaaaaaa" # => 7
"fuu" # => 0
"foobar" # => 1
"aaa bbb ccc" # => 3
"aa bb cc aaaaa ff" # => 5
I’m using Ruby 1.9.3. According to the String class, I don’t think there’s already a method that can do this stuff. Maybe the Regexp class could be more useful.
Do you think there’s a sexy way to do it? Thank for any suggestions.
My way is:
or if that will not work then (but it should)