#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;

int main() {
	constexpr auto doMatch = ".txt";
	constexpr auto doMatchSize = strlen(doMatch);
	constexpr auto doNotMatch = "_test";
	constexpr auto doNotMatchSize = strlen(doNotMatch) + doMatchSize;
	string input("somepath/testFile_test.txt");
	
	if(input.size() >= doMatchSize &&
	   equal(input.end() - doMatchSize, input.end(), doMatch) &&
	   (input.size() < doNotMatchSize ||
	   !equal(input.end() - doNotMatchSize, input.end() - doMatchSize, doNotMatch))){
		cout << "pass" << endl;
   }else{
   		cout << "fail" << endl;
   }
	
	return 0;
}