$S=<>; { $_=$S; s/h//g; y/e/h/; $x=1; $M=0; s{phn(om)+}{ $t=(-3+length$&)/2; $x+=$t; $M=$t+1 if $t+1>$M }ge; $z=$x+$M; } { $_=$S; $x=0; $M=0; s{phn(om)+}{ $t=(-3+length$&)/2; $x+=$t; $M=$t+1 if $t+1>$M }ge; $z=$x+$M if $x+$M>$z; } print$z,$/