#include <iostream>
#include <regex>
using namespace std;

int main() {
	regex rx1("(2|25)");
	regex rx2("(25|2)");
	string s = "2225";
	
	for (sregex_iterator it(s.begin(), s.end(), rx1), end; it != end; ++it) {
	    cout << it->position() << ": " << it->str() << endl;
	}
	
	cout << endl;
	
	for (sregex_iterator it(s.begin(), s.end(), rx2), end; it != end; ++it) {
	    cout << it->position() << ": " << it->str() << endl;
	}
	
	return 0;
}