Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <regex>
- #include <iterator>
- #include <string>
- using namespace std;
- int main()
- {
- int index = 0;
- string str;
- smatch result_1;
- smatch result_2;
- regex fit(R"(Merlin\\s*speaks)");
- regex avada(R"(Avada-ke-davra)");
- while (getline(cin, str))
- {
- index++;
- if (regex_search(str, result_1, fit))
- {
- cout << index << " ";
- if (regex_search(str, result_2, avada))
- cout << result_2.position() << endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement