s="hello"puts s.scan(/lo/).counts="oooooo"puts s.scan(/o/).countputs s.scan(/oo/).count
Standard input is empty
1 6 3
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!