Can I know where’s my mistake? I think I’ve the same input and output with the example. This is my code https://www.codechef.com/viewsolution/21338811
#include //#include #include //#include #include #include int inputNum; std::vector<std::array> numberPosition; bool check(std::string input){ for(int i = 0; i < input.length(); i++){ if(std::isdigit(input[i])){ int index = input[i] - '0'; //std::cout<<typeid(index).name()<<" "<<index<<std::endl; numberPosition.push_back({index, i}); } } int min; int max = -10; for(auto numberMap: numberPosition){ //std::cout<<max<<"|"<<numberMap[1]-numberMap[0]<= numberMap[1]-numberMap[0]){ return false; } min = numberMap[1]-numberMap[0]; max = numberMap[1]+numberMap[0]; //std::cout<<max<<" | "<<min<>inputNum; while(inputNum--){ std::string input; std::cin>>input; std::string res = (check(input))?"safe":"unsafe"; std::cout<<res<<std::endl; } }