Advertisement
STANAANDREY

var4 2k16 22/2/2022 sb2

Feb 22nd, 2022
789
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4. #define SIZE 20
  5. char words[SIZE][SIZE];
  6. int n, k;
  7.  
  8. int main() {
  9.     cin >> n;
  10.     for (int i = 0; i < n; i++) {
  11.         cin >> words[i];
  12.     }
  13.     cin >> k;
  14.  
  15.     for (int i = 0; i < n; i++) {
  16.         if (strlen(words[i]) == k) {
  17.             cout << words[i] << ' ';
  18.         }
  19.     }
  20.  
  21.     for (int i = 0; i < n; i++) {
  22.         if (strlen(words[i]) != k) {
  23.             cout << words[i] << ' ';
  24.         }
  25.     }
  26.  
  27.     return 0;
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement