Replacement writeup

Replacement writeup

Challenge name: Replacement

Difficulty: 

Challenge Scenario: A cursed spell has altered a scroll, changing key letters. Replace the haunted letter with a random one to break the curse!

Link: https://app.hackthebox.com/challenges/Replacement?tab=play_challenge

Machine IP: 154.57.164.67:32493

Navigated to the site and it’s a coding challenge. 

It looks like it wants us to replace input 2 with input 3 in a given string input 3. I had some confusion on the input. I thought I had to keep it the way it was. Instead I split them. The we set output. Iterated through n and if the character was equal to the 2nd input we replace it and add to output otherwise just add to output.

# take in the number
n = input()
b = input()
c = input()
# calculate answer
output = ""
for i in n:
if i == b:
i = c
output = output + c
else:
output = output + i
# print answer
print(output)

And I got the flag.

GG

Leave a comment