s<-'hhaaappppyyyyyyy mmoooooorning friendsssssssssssssss, good goood day'gsub('([[:alpha:]])\\1{2,}', '\\1\\1', s)
Standard input is empty
[1] "hhaappyy mmoorning friendss, good good day"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!