Record Case Detail

Notes

This function is in beta test. Please help improve it in the issues here.

Stderr

=================================================================
==35476==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61d000000888 at pc 0x5564b8a5b1be bp 0x7ffecd4f88d0 sp 0x7ffecd4f88c0
READ of size 8 at 0x61d000000888 thread T0
    #0 0x5564b8a5b1bd in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const (/out/package/ex1+0x141bd)
    #1 0x5564b8a59bb8 in __gnu_cxx::__enable_if<std::__is_char<char>::__value, bool>::__type std::operator==<char>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (/out/package/ex1+0x12bb8)
    #2 0x5564b8a57cd3 in findSingleWord(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) (/out/package/ex1+0x10cd3)
    #3 0x5564b8a58870 in main (/out/package/ex1+0x11

Hints

Your answer may be identical to the JOJ answer in the first several lines.

However, the main problem you meet now is Runtime Error. And the exit code of your program is 1, which should be 0.

Please double check your code to solve this problem and try again.

Your Answer


        

JOJ Answer

path