Escape It Before You Render It
75 points · 0 solved
Cross-site scripting (XSS) happens when user text is dropped into HTML as-is. The first line is T; each of the next T lines is untrusted text. Print each line HTML-escaped: &→&, <→<, >→>, "→", '→'. Every other character stays the same.
Escape & first in your head — < in the input must become &lt;.
Example 1 input
2 <b>hi</b> 5 > 3 & 2 < 4
Expected output
<b>hi</b> 5 > 3 & 2 < 4
main.py
Ctrl+Enter runs · Ctrl+Shift+Enter submits