Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. int main() {
  5. int n;
  6. const char old[] = "Nemo";
  7. scanf("%d", &n);
  8. char s[n][90];
  9. for (int i = 0; i < n; i++)
  10. {
  11. fflush(stdin);
  12. gets(s[i]);
  13. }
  14. for (int i = 0 ; i < n ; i++)
  15. {
  16. if (s[i][0] == old[0] && s[i][1] == old[1])
  17. {
  18. if (i == n - 1)
  19. {
  20. printf("%s and %s", s[i-1], s[0]);
  21. break;
  22. }
  23. else
  24. {
  25. printf("%s and %s", s[i-1], s[i+1]);
  26. }
  27. }
  28. }
  29.  
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement