fork(12) download
  1. #include <iostream>
  2. #include <regex>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main() {
  7. std::string input_seq = "CCCC";
  8. std::regex re("(?=(CCC)).");
  9. std::sregex_iterator next(input_seq.begin(), input_seq.end(), re);
  10. std::sregex_iterator end;
  11. while (next != end) {
  12. std::smatch match = *next;
  13. std::cout << match.str(1) << "\t" << "\t" << match.position() << "\t" << "\n";
  14. next++;
  15. }
  16. return 0;
  17. }
Success #stdin #stdout 0s 3556KB
stdin
Standard input is empty
stdout
CCC		0	
CCC		1