Language: C

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

typedef int		BOOL;
#define TRUE	1;
#define FALSE	0;

typedef struct Word{
	char	word[31];
	int		page;
}	WORD;

WORD wordArray[100];

void input();
	BOOL is_smaller(WORD, int);
void output();
#include <stdio.h>
#include <string.h>

typedef int		BOOL;
#define TRUE	1;
#define FALSE	0;

typedef struct Word{
	char	word[31];
	int		page;
}	WORD;

WORD wordArray[100];

void input();
	BOOL is_smaller(WORD, int);
void output();

int main()
{
    input();
    output();
	
	return 0;
}

void input()
{
	int 	cnt1, cnt2;
	WORD	tempWORD;
	
	while(scanf("%s %d", tempWORD.word, &tempWORD.page) != EOF)
		for(cnt1 = 0; cnt1 < 100; cnt1++){
			if(wordArray[cnt1].page == 0){
				strcpy(wordArray[cnt1].word, tempWORD.word);
				wordArray[cnt1].page = tempWORD.page;
				break;
			}
			else if(is_smaller(tempWORD, cnt1)){
				for(cnt2 = 98; cnt2 >= cnt1; cnt2--){
					strcpy(wordArray[cnt2 + 1].word, wordArray[cnt2].word);
					wordArray[cnt2 + 1].page = wordArray[cnt2].page;
				}
				strcpy(wordArray[cnt1].word, tempWORD.word);
				wordArray[cnt1].page = tempWORD.page;
				break;
			}
		}
}

BOOL is_smaller(WORD tempWORD, int cnt)
{
	if(strcmp(tempWORD.word, wordArray[cnt].word) < 0){
		return TRUE;
	}
	else if(strcmp(tempWORD.word, wordArray[cnt].word) == 0){
		if(tempWORD.page < wordArray[cnt].page)
		{
			return TRUE;
		}
		else
		{
			return FALSE;
		}
	}
	else{
		return FALSE;
	}
}

void output()
{
	int		output_cnt = 0;
	char	last_print_word[31] = "";

	while(wordArray[output_cnt].page != 0)
	{
		if(strcmp(last_print_word, "") == 0)
		{
			printf("%s\n", wordArray[output_cnt].word);
			strcpy(last_print_word, wordArray[output_cnt].word);
		}
		else if(strcmp(wordArray[output_cnt].word, last_print_word) != 0)
		{
			printf("\n%s\n", wordArray[output_cnt].word);
			strcpy(last_print_word, wordArray[output_cnt].word);
		}
		else
		{
			printf(" ");
		}
		printf("%d", wordArray[output_cnt].page);
		output_cnt++;
	}
	printf("\n");
}
int main()
{
    input();
    output();
	
	return 0;
}

void input()
{
	int 	cnt1, cnt2;
	WORD	tempWORD;
	
	while(scanf("%s %d", tempWORD.word, &tempWORD.page) != EOF)
		for(cnt1 = 0; cnt1 < 100; cnt1++){
			if(wordArray[cnt1].page == 0){
				strcpy(wordArray[cnt1].word, tempWORD.word);
				wordArray[cnt1].page = tempWORD.page;
				break;
			}
			else if(is_smaller(tempWORD, cnt1)){
				for(cnt2 = 98; cnt2 >= cnt1; cnt2--){
					strcpy(wordArray[cnt2 + 1].word, wordArray[cnt2].word);
					wordArray[cnt2 + 1].page = wordArray[cnt2].page;
				}
				strcpy(wordArray[cnt1].word, tempWORD.word);
				wordArray[cnt1].page = tempWORD.page;
				break;
			}
		}
}

BOOL is_smaller(WORD tempWORD, int cnt)
{
	if(strcmp(tempWORD.word, wordArray[cnt].word) < 0)
		return TRUE;
	else if(strcmp(tempWORD.word, wordArray[cnt].word) == 0)
	{
		if(tempWORD.page < wordArray[cnt].page)
		{
			return TRUE;
		}
		else
		{
			return FALSE;
		}
	}
	else
	{
		return FALSE;
	}
}

void output()
{
	int		output_cnt = 0;
	char	last_print_word[31] = "";

	while(wordArray[output_cnt].page != 0)
	{
		if(strcmp(last_print_word, "") == 0)
		{
			printf("%s\n", wordArray[output_cnt].word);
			strcpy(last_print_word, wordArray[output_cnt].word);
		}
		else if(strcmp(wordArray[output_cnt].word, last_print_word) != 0)
		{
			printf("\n%s\n", wordArray[output_cnt].word);
			strcpy(last_print_word, wordArray[output_cnt].word);
		}
		else
		{
			printf(" ");
		}
		printf("%d", wordArray[output_cnt].page);
		output_cnt++;
	}
	printf("\n");
}

Compiler output:
main.c:25:16: error: redefinition of 'struct Word'
   25 | typedef struct Word{
      |                ^~~~
main.c:8:16: note: originally defined here
    8 | typedef struct Word{
      |                ^~~~
main.c:28:9: error: conflicting types for 'WORD'; have 'struct Word'
   28 | }       WORD;
      |         ^~~~
main.c:11:9: note: previous declaration of 'WORD' with type 'WORD' {aka 'struct Word'}
   11 | }       WORD;
      |         ^~~~
main.c:30:6: error: conflicting types for 'wordArray'; have 'WORD[100]' {aka 'struct Word[100]'}
   30 | WORD wordArray[100];
      |      ^~~~~~~~~
main.c:13:6: note: previous declaration of 'wordArray' with type 'WORD[100]' {aka 'struct Word[100]'}
   13 | WORD wordArray[100];
      |      ^~~~~~~~~
main.c:33:14: error: conflicting types for 'is_smaller'; have 'BOOL(WORD,  int)' {aka 'int(struct Word,  int)'}
   33 |         BOOL is_smaller(WORD, int);
      |              ^~~~~~~~~~
main.c:16:14: note: previous declaration of 'is_smaller' with type 'BOOL(WORD,  int)' {aka 'int(struct Word,  int)'}
   16 |         BOOL is_smaller(WORD, int);
      |              ^~~~~~~~~~
main.c:68:6: error: conflicting types for 'is_smaller'; have 'BOOL(WORD,  int)' {aka 'int(struct Word,  int)'}
   68 | BOOL is_smaller(WORD tempWORD, int cnt)
      |      ^~~~~~~~~~
main.c:16:14: note: previous declaration of 'is_smaller' with type 'BOOL(WORD,  int)' {aka 'int(struct Word,  int)'}
   16 |         BOOL is_smaller(WORD, int);
      |              ^~~~~~~~~~
main.c:114:5: error: redefinition of 'main'
  114 | int main()
      |     ^~~~
main.c:36:5: note: previous definition of 'main' with type 'int()'
   36 | int main()
      |     ^~~~
main.c:122:6: error: redefinition of 'input'
  122 | void input()
      |      ^~~~~
main.c:44:6: note: previous definition of 'input' with type 'void()'
   44 | void input()
      |      ^~~~~
main.c:146:6: error: conflicting types for 'is_smaller'; have 'BOOL(WORD,  int)' {aka 'int(struct Word,  int)'}
  146 | BOOL is_smaller(WORD tempWORD, int cnt)
      |      ^~~~~~~~~~
main.c:16:14: note: previous declaration of 'is_smaller' with type 'BOOL(WORD,  int)' {aka 'int(struct Word,  int)'}
   16 |         BOOL is_smaller(WORD, int);
      |              ^~~~~~~~~~
main.c: In function 'is_smaller':
main.c:150:9: error: 'else' without a previous 'if'
  150 |         else if(strcmp(tempWORD.word, wordArray[cnt].word) == 0)
      |         ^~~~
main.c: At top level:
main.c:167:6: error: redefinition of 'output'
  167 | void output()
      |      ^~~~~~
main.c:88:6: note: previous definition of 'output' with type 'void()'
   88 | void output()
      |      ^~~~~~