Language: C

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

typedef struct Words
{
    char	word[30];
    int		page[100];
} WORDS;

WORDS	wordArray[100];

WORDS* printMinWord(WORDS*);
WORDS* printMinPage(WORDS*);

int main()
{
    char	tempWord[30];
    int		tempPage;
    int		wordCnt;
    int		pageCnt;
    int		inputCnt = 0;
	
    while (scanf("%s %d", tempWord", &tempPage) != EOF)
    {
        wordCnt = 0;
        /*sort page to each words*/
        while(1)
        {
            if(!strcmp(tempWord, wordArray[wordCnt].word))
            {
                for(pageCnt = 1; pageCnt < 100; pageCnt++)
                {
                    if(!(wordArray[wordCnt].page[pageCnt]))
                    {
                        break;
                    }
                }
                wordArray[wordCnt].page[pageCnt] = tempPage;
                break;
            }
            else if(!strcmp("", wordArray[wordCnt].word))
            {
                strcpy(wordArray[wordCnt].word, tempWord);
                wordArray[wordCnt].page[0] = tempPage;
                break;
            }
            wordCnt++;
        }
    }

    printMinWord(wordArray);


    return 0;
} 

WORDS* printMinWord(WORDS* word_array)
{
	int		word_cnt;
	char	min_word[30]	= "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
	int		min_word_index	= -1;
	
	/*find min word and its index*/
	for(word_cnt = 0; word_cnt < 100; word_cnt++)
	{
		if(!strcmp(word_array[word_cnt].word, ""))
		{
			continue;
		}
		if(strcmp(word_array[word_cnt].word, min_word) < 0)
		{
			strcpy(min_word, word_array[word_cnt].word);
			min_word_index = word_cnt;
		}
	}
	
	/*no recursion if no word content*/
	if(min_word_index == -1)
	{
		return word_array;
	}
	printf("%s\n", word_array[min_word_index].word);
	
	/*print subsequential pages of min word*/
	printMinPage(&word_array[min_word_index]);
	
	strcpy(word_array[min_word_index].word, "");
	
	return printMinWord(word_array);
}

WORDS* printMinPage(WORDS* word_array)
{
	int		page_cnt;
	int		min_page = 1001;
	int		min_page_index	= -1;
		
	/*find min page and its index*/
	
	
	for(page_cnt = 0; page_cnt < 100; page_cnt++)
	{
		if(word_array->page[page_cnt] == 0)
		{
			continue;
		}
		if(word_array->page[page_cnt] < min_page)
		{
			min_page = word_array->page[page_cnt];
			min_page_index = page_cnt;
		}
	}
	
	/*no recursion if no page content*/
	if(min_page_index == -1)
	{
		printf("\n");
		return word_array;
	}
	printf("%d", word_array->page[min_page_index]);
	word_array->page[min_page_index] = 0;
	
	for(page_cnt = 0; page_cnt < 100; page_cnt++)
	{
		if(word_array->page[page_cnt] == 0)
		{
			continue;
		}
		printf(" ");
		return printMinPage(word_array);
	}
	
	
	
	return printMinPage(word_array);
}

Compiler output:
main.c: In function 'main':
main.c:24:35: warning: missing terminating " character
   24 |     while (scanf("%s %d", tempWord", &tempPage) != EOF)
      |                                   ^
main.c:24:35: error: missing terminating " character
   24 |     while (scanf("%s %d", tempWord", &tempPage) != EOF)
      |                                   ^~~~~~~~~~~~~~~~~~~~~
main.c:24:35: error: expected ')' before '{' token
   24 |     while (scanf("%s %d", tempWord", &tempPage) != EOF)
      |                 ~                 ^
      |                                   )
   25 |     {
      |     ~                              
main.c:55:14: error: expected ')' before '}' token
   55 |     return 0;
      |              ^
      |              )
   56 | }
      | ~             
main.c:24:11: note: to match this '('
   24 |     while (scanf("%s %d", tempWord", &tempPage) != EOF)
      |           ^
main.c:56:1: error: expected expression before '}' token
   56 | }
      | ^