Here's my rough cut:
1{h;d};/^\(.\)\1\1*$/{x;y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/;x;d};x;${p;x}