Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     freopen("input.txt", "r", stdin);
  6.     freopen("output.txt", "w", stdout);
  7.     char str[31];
  8.     scanf("%s", str);
  9.     int i = 0;;
  10.     while (str[i] != '.')
  11.         i++;
  12.  
  13.     if (str[i - 1] == 'e')
  14.     {
  15.         str[i] = 'r';
  16.     }
  17.     else if ((str[i - 1] == 'r') && (str[i - 2] == 'e'))
  18.     {
  19.         str[i - 1] = 's';
  20.         str[i] = 't';
  21.     }
  22.     else
  23.     {
  24.         str[i] = 'e';
  25.         str[i+1] = 'r';
  26.         for (int j = i + 2; j < 31; j++)
  27.             str[j] = '\0';
  28.     }
  29.  
  30.     printf("%s", str);
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement