Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <string>
  2. #include <iostream>
  3. #include <regex>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     freopen("input.txt", "r", stdin);
  9.     freopen("output.txt", "w", stdout);
  10.     string str;
  11.     smatch result;
  12.     regex reg("([1-9][0-9]*[\\+\\-\\*\\/]*[1-9]*[0-9]*");
  13.     while (getline(cin, str))
  14.     {
  15.         while (regex_search(str, result, reg))
  16.         {
  17.             cout << result.str(0) << "\n";
  18.             str = result.suffix().str();
  19.         }
  20.     }
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement