String window problem

terminate called after throwing an instance of ‘std::out_of_range’
what(): basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 0)

cant figure out how to solve this error

code link provided

@rohit_1906 If no matches were found, the find() function returns string::npos