Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. typedef vector <string> vc;
  6. vc vstr1, vstr2; //one saves the first word and two saves the second word, which is next to the english word
  7. string str; //for reading
  8. string word_english; //save the english word
  9.  
  10. int main() {
  11.     int readings, amount_words;
  12.     int count = 0;
  13.     cin >> readings;
  14.  
  15.     for (int i = 0; i < readings; ++i) {
  16.         cin >> amount_words;
  17.  
  18.         for (int j = 0; j < amount_words; ++j) {
  19.             cin >> str [j];
  20.  
  21.             if (str[j] != '#') {
  22.                 word_english = str [j];
  23.                 ++count;
  24.             }
  25.             else if (count > 0) {
  26.                 vstr2.push_back(str[j]);
  27.             }
  28.             else if  (str[j] == '#') {
  29.                 vstr1.push_back(str[j]);
  30.             }
  31.         }
  32.     }
  33.  
  34.     for (int i = 0; i < vstr2.size(); ++i) {
  35.         cout << vstr2 [i] << " ";
  36.     }
  37.  
  38.     cout << word_english;
  39.  
  40.     for (int i = 0; i < vstr1.size(); ++i) {
  41.         cout << vstr1 [i] << " ";
  42.     }
  43.    
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement