SHARE
TWEET

Untitled

a guest Oct 20th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top