Base64url Without the Padding
100 points · 0 solved
JWTs and many tokens use base64url: - and _ instead of + and /, and the = padding removed. The first line is T; each next line is a token. Print the decoded UTF-8 text, or INVALID if the token has any character outside A-Z a-z 0-9 - _, has a length where length % 4 == 1, or doesn't decode to valid UTF-8. An empty line decodes to an empty line.
Example 1 input
2 aGVsbG8gd29ybGQ not*valid
Expected output
hello world INVALID
main.py
Ctrl+Enter runs · Ctrl+Shift+Enter submits