use strict; my $word = ; if($word=~/(.*)(.*c)(([^w]*w){2,2})(.*)/){ print length($2)+length($3),"\n"; }else{ print -1,"\n"; }