Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <iostream>
- #include <regex>
- using namespace std;
- int main()
- {
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- string str;
- smatch result;
- regex reg("([1-9][0-9]*[\\+\\-\\*\\/]*[1-9]*[0-9]*");
- while (getline(cin, str))
- {
- while (regex_search(str, result, reg))
- {
- cout << result.str(0) << "\n";
- str = result.suffix().str();
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement