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

int main() {
	std::regex reg("/?([^/]+)/?$");
	std::string s("/home/fypj/build/simple-loops.cc/");
	std::cout << std::regex_replace(s, reg, "/$1/$1/") << std::endl;
	
	return 0;
}