#! /n/gnu/bin/gawk -f
# Last edited on 1999-12-01 00:45:46 by stolfi

# Reads a stream of words, one per line. Deletes leading "q"s, writes all the
# maximal substrings of "e" letters, with the preceding letter (or "_"
# if there is none), one per line.

/^ *$/{next;}
/./{ 
  gsub(/^[q]/, "", $0);
  
  # Insert "_" before every word:
  
  gsub(/^/, "_", $0);
  
  # Replace every non-"e" string by a line break and the last letter
  # of that string:
  
  gsub(/[^e][^e]*$/, "", $0);
  $0 = gensub(/[^e]*([^e])/, "\n\\1", "g", $0);
  
  print $0;
}