The function below renders user-controlled content directly into an HTML string.
The bug: an attacker can inject <script>alert('XSS')</script> as the argument and execute arbitrary JavaScript in the user's browser.
Your task: fix solve(str) so that every HTML special character is escaped before being returned.
| Character | Escaped form |
|---|---|
& | & |
< | < |
> | > |
" | " |
' | ' |
Safe strings must pass through unchanged.
Sample tests