Advertisement
allia

хихи

Feb 10th, 2021
767
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <regex>
  3. #include <iterator>
  4. #include <string>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     int index = 0;
  10.     string str;
  11.     smatch result_1;
  12.     smatch result_2;
  13.  
  14.     regex fit(R"(Merlin\\s*speaks)");
  15.     regex avada(R"(Avada-ke-davra)");
  16.    
  17.     while (getline(cin, str))
  18.     {
  19.         index++;
  20.         if (regex_search(str, result_1, fit))
  21.          {
  22.            cout << index << " ";
  23.             if (regex_search(str, result_2, avada))
  24.               cout << result_2.position() << endl;
  25.          }
  26.     }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement