Notes
This function is in beta test. Please help improve it in the issues
here.
/in/ex1.h:13:20: runtime error: index 110 out of bounds for type 'int [100]' /in/ex1.h:13:22: runtime error: store to address 0x7ffdb09f7768 with insufficient space for an object of type 'int' 0x7ffdb09f7768: note: pointer points here fd 7f 00 00 00 ac 95 a4 6a 7c 10 6e 20 78 9f b0 fd 7f 00 00 a0 75 e6 4e ef 55 00 00 c0 78 9f b0 ^ ================================================================= ==35039==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffdb09f774c at pc 0x55ef4ec4ce8c bp 0x7ffdb09f7550 sp 0x7ffdb09f7540 WRITE of size 4 at 0x7ffdb09f774c thread T0 #0 0x55ef4ec4ce8b 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+0xde8b) #1 0x55ef4ec4d8cd in main (/out/package/ex1+0xe8cd) #2 0x7f4552e30b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #3 0x55ef4ec4c969
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
beautifully