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

#define SIZE 200

void printLatinWord(char word[])
{
    int length = (int)strlen(word);

    if (length >= 2)
    {
        for (int i = 1; i < length; ++i)
        {
            printf("%c", word[i]);
        }

        printf("%cay", word[0]);
    }
    else
    {
        printf("%say", word);
    }
}

int main(void)
{
    char sentence[SIZE];

    printf("Enter an English phrase: ");
    fgets(sentence, SIZE, stdin);

    sentence[strcspn(sentence, "\n")] = '\0';

    char *tokenPtr = strtok(sentence, " ");

    while (tokenPtr != NULL)
    {
        printLatinWord(tokenPtr);

        tokenPtr = strtok(NULL, " ");

        if (tokenPtr != NULL)
        {
            printf(" ");
        }
    }

    puts("");

    return 0;
}