#include <fstream>
#include <iostream>
#include <string>
bool isFileExist(const char *fileName)
{
std::ifstream file(fileName);
return file.good();
}
int main(int argc, char const *argv[])
{
std::string rootFilename;
for(int i=0; i<10000; i++) {
char ch[5];
sprintf(ch, "%04d", i);
rootFilename = "resortLess";
rootFilename += ch;
rootFilename += ".root";
if(isFileExist(rootFilename.c_str())) {
continue;
}
break;
}
std::cout << rootFilename << std::endl;
return 0;
}