#!/bin/perl while (<>) { s/\b([a-z])([a-z][a-z]+)([a-z])\b/$1 . length($2) . $3/eig; print; }