/*
 *                 words1
 *
 *      Reconstructed from pdp11 binary
 */

char dups[128];         /* count of occurrences of each character */
char buf[128];          /* for output strings */

main(argc, argv)
char **argv;
{
	register int    min, n, i;
	register char   c, *p;

	min = 1;
	if (argc > 1 && argv[1][0] == '-') {
		min = argv[1][1] - '0';
		if (min < 1 || min > 9)
			min = 1;
		argv++;
		argc--;
	}
	for (p = argv[1]; *p; p++)
		dups[*p]++;
	if (min > 1)
		printf("#n\n");
	for (n = 1; n < 10; n++) {
		p = buf;
		for (c = 'A'; c <= 'Z'; c++)
			if (dups[c] == n)
				*p++ = c;
		for (c = 'a'; c <= 'z'; c++)
			if (dups[c] == n)
				*p++ = c;
		if (p != buf) {
			*p = '\0';
			printf("/\\([%s]\\)", buf);
			for (i = 0; i < n; i++)
				printf(".*\\1");
			printf("/d\n");
		}
	}
	printf("s/-//g\n");
	printf("/");
	while (min--)
		printf(".");
	printf("/p\n");
}
