So solved this part a little bit differently, than in given example but also got a bug. Which I managed to solve on my own.
So the problem was that for some reason when I entered string that was shorter than the given word, let’s say 3 chars, it would still try to acces to 4th and 5th chars in it, because the given word was longer and it tried to go through to the end of it (I’m sorry if the explantation is a bit messy, english isn’t my first language, but I hope that anyone who reads this gets the idea). And it ment that the programm crushed, because it was trying to access sth that wasn’t there.
But yeah, as I said managed to solve it. The code I ended up with is in the image. Hope somone finds this helpfull or interesting