fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. #define SIZE 200
  5.  
  6. void printLatinWord(char word[])
  7. {
  8. int length = (int)strlen(word);
  9.  
  10. if (length >= 2)
  11. {
  12. for (int i = 1; i < length; ++i)
  13. {
  14. printf("%c", word[i]);
  15. }
  16.  
  17. printf("%cay", word[0]);
  18. }
  19. else
  20. {
  21. printf("%say", word);
  22. }
  23. }
  24.  
  25. int main(void)
  26. {
  27. char sentence[SIZE];
  28.  
  29. printf("Enter an English phrase: ");
  30. fgets(sentence, SIZE, stdin);
  31.  
  32. sentence[strcspn(sentence, "\n")] = '\0';
  33.  
  34. char *tokenPtr = strtok(sentence, " ");
  35.  
  36. while (tokenPtr != NULL)
  37. {
  38. printLatinWord(tokenPtr);
  39.  
  40. tokenPtr = strtok(NULL, " ");
  41.  
  42. if (tokenPtr != NULL)
  43. {
  44. printf(" ");
  45. }
  46. }
  47.  
  48. puts("");
  49.  
  50. return 0;
  51. }
Success #stdin #stdout 0s 5348KB
stdin
Standard input is empty
stdout
Enter an English phrase: �YZe�ay