Advertisement
STANAANDREY

bac 4/20/2022 2

Apr 20th, 2022
925
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4. char s[100], r[2][100][100];
  5.  
  6. int main() {
  7.     int n, ok[2] = {}, k = 0, len[2] = {};
  8.     cin >> n;
  9.     cin.get();
  10.     cin.getline(s, 100);
  11.     char *p = strtok(s, " ");
  12.     while (p) {
  13.         int cond = (strlen(p) >= n);
  14.         strcpy(r[cond][len[cond]++], p);
  15.         ok[cond] = 1;
  16.         p = strtok(NULL, " ");
  17.     }
  18.     if (ok[0] && ok[1])
  19.         for (int i = 1; i >= 0; i--)
  20.             for (int j = 0; j < len[0]; j++)
  21.                 puts(r[i][j]);
  22.     else
  23.         puts("nu exista");
  24.  
  25.     return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement