untermud/DOC/
untermud/DOC/U/
untermud/DOC/U/U-examples/
untermud/DOC/internals/
untermud/DOC/wizard/
untermud/MISC/
untermud/MISC/dbchk/
untermud/RWHO/
untermud/RWHO/rwhod/
#include    <stdio.h>
#include    <ctype.h>

/* this code is not pretty, nor does it have to be */
/* run as:
bigrams < database | sort -n -r | head -128
will give the 128 most used bigrams in the db. then edit comp.h
*/


int main (int argc, char **argv)
{
  int counts[256][256];
  int last;
  int c;

  for (c = 0; c < 255; c++)
    for (last = 0; last < 255; last++)
      if (!isprint (c) || !isprint (last))
        counts[c][last] = -1;
      else
        counts[c][last] = 0;

  while (1) {
    c = getchar ();
    if (feof (stdin))
      break;

    if (last == -1 || c == '\n') {
      if (c != '\n')
        last = c;
      continue;
    }
    if (counts[last][c] != -1)
      counts[last][c]++;
    last = c;
  }

  for (c = 0; c < 255; c++)
    for (last = 0; last < 255; last++)
      if (counts[c][last] > 0)
        printf ("%d \"%c%c\"\n", counts[c][last], c, last);

  return 0;
}