Bug Report for https://neetcode.io/problems/string-encode-and-decode
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
Description
When writing C++ solutions in the interactive web editor, lines containing single-quoted character literals (e.g. '$') are truncated during the code submission or compilation phase. This causes standard compilation errors such as:
warning: missing terminating ' character
error: expected expression
Replacing the character literal with a double-quoted string literal ("$") avoids the issue, suggesting a preprocessing or text-streaming bug in either the frontend editor or the backend code runner.
Steps to Reproduce
- Open any C++ problem (e.g. Encode and Decode Strings).
- Use a single-quoted character literal as a delimiter, for example:
size_t end = s.find('$');
// OR
while (std::getline(ss, token, '$'))
- Click Run Code or Submit.
Expected Behavior
The code should compile successfully, treating '$' as a valid C++ char literal.
Actual Behavior
The submitted code appears to be truncated immediately after the opening single quote, resulting in compilation errors such as:
main.cpp:44:29: warning: missing terminating ' character [-Winvalid-pp-token]
44 | size_t end = s.find('
| ^
main.cpp:44:29: error: expected expression
44 | size_t end = s.find('
| ^
Environment
- Platform: NeetCode.io Web Code Editor
- Language: C++
- Browser: chrome
Bug Report for https://neetcode.io/problems/string-encode-and-decode
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
Description
When writing C++ solutions in the interactive web editor, lines containing single-quoted character literals (e.g.
'$') are truncated during the code submission or compilation phase. This causes standard compilation errors such as:warning: missing terminating ' charactererror: expected expressionReplacing the character literal with a double-quoted string literal (
"$") avoids the issue, suggesting a preprocessing or text-streaming bug in either the frontend editor or the backend code runner.Steps to Reproduce
Expected Behavior
The code should compile successfully, treating
'$'as a valid C++charliteral.Actual Behavior
The submitted code appears to be truncated immediately after the opening single quote, resulting in compilation errors such as:
Environment