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

#define N 20

int main( void )
{
    
    char max[N];
    char min[N];
    char (*ch)[N];
    char inputStr[N] ;
    int length = 0;
    

    fgets(inputStr, sizeof(inputStr), stdin);
    
    
    
    //technique fr: https://stackoverflow.com/a/28462221/701302
    inputStr[strcspn(inputStr, "\n")] = 0;
    
    
    
    strcpy(max,inputStr);
    strcpy(min,inputStr);

    do
    {
        fgets(inputStr, sizeof(inputStr), stdin);
        
        //technique fr: https://stackoverflow.com/a/28462221/701302
        inputStr[strcspn(inputStr, "\n")] = 0;
        
        if (strcmp(inputStr,max) > 0){ 
            strcpy(max,inputStr);
        }
        else
        if ( strcmp(inputStr,min)  < 0){
            strcpy(min,inputStr);
        }    
        length = strlen(inputStr);  
    } while (length != 4);
   
     printf("largest word is: %s\n",max);
     
     ch = &min;
     if (strcmp(ch,"") == 0){
     	ch = "[empty string]";
     }
     printf("smallest word is: %s",ch); 

}