#include <stdio.h>
#include <string.h>

int main()
{
	char	buf[110];
	char	*index[10];
	char	str[11];
	char	*next;
	int	count[10] = {0};
	int	c, i;

	next = buf;
	for (c = 0; c < 10; ) {
		printf("入力文字列-->");
		scanf("%10s", str);
		if (strcasecmp(str, "end") == 0) {	// _stricmp
			break;
		}
		for (i = 0; i < c; i++) {
			if (strcmp(str, index[i]) == 0) {
				break;
			}
		}
		if (i == c) {
			strcpy(next, str);
			index[c] = next;
			c++;
			next += strlen(str) + 1;
		}
		count[i]++;
	}

	printf("*** 集計結果 ***\n");
	for (i = 0; i < c; i++) {
		printf("%2d:%-10s:%d件\n", i + 1, index[i], count[i]);
	}

	return 0;
}
