Doubles.pl

[ Perl ]

26 Jun 2012

#!/usr/bin/perl -w
$_="hello woooroold";
/(?:
 ((.)\2+) (?{$c++ if length($1)==2})
 | .
 )*
 (?{ print 0+$c})
/x;