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