hopingsteam

Untitled

May 6th, 2020
846
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include    <iostream>
  2. #include    <cstring>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     unsigned int n;
  9.     char vector[20][21];
  10.     cin >> n;
  11.  
  12.     for(int i = 0; i < n; i++)
  13.         cin >> vector[i];
  14.  
  15.     char ultCuvant[21];
  16.     strcpy(ultCuvant, vector[n - 1]);
  17.  
  18.     for(int i = 0; i < n - 1; i++)
  19.     {
  20.         if(strncmp(vector[i], ultCuvant, strlen(ultCuvant)) == 0)
  21.             cout << vector[i] << "\n";
  22.     }
  23.     return 0;
  24. }
RAW Paste Data