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

int main() {
	string line = "echo                7/tcp\n";
	string regexStr = "^([A-Za-z][^ ]*)\\s+(\\d{1,5})/(tcp|udp)\\b[\\s\\S]*";
	regex rg(regexStr); 
	smatch sm;
	if (regex_match(line, sm, rg)) {
			std::cout << sm[1] << std::endl;
			std::cout << sm[2] << std::endl;
			std::cout << sm[3] << std::endl;
		}
	return 0;
}