Created
May 14, 2022 11:05
-
-
Save washingtonsoares/9175ffae5c05d5fb3ff0d0a9fef73b4e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while True: | |
try: | |
text = input() | |
shortcuts = [] | |
resultText = "" | |
for i in range(len(text)): | |
currentChar = text[i] | |
if (currentChar == "_"): | |
if (len(shortcuts) > 0 and shortcuts[-1] == "_"): | |
shortcuts.pop() | |
resultText += "</i>" | |
else: | |
shortcuts.append("_") | |
resultText += "<i>" | |
elif (currentChar == "*"): | |
if (len(shortcuts) > 0 and shortcuts[-1] == "*"): | |
shortcuts.pop() | |
resultText += "</b>" | |
else: | |
shortcuts.append("*") | |
resultText += "<b>" | |
else: | |
resultText += currentChar | |
print(resultText) | |
except EOFError: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment