Analyze the following code. Match each input with its result.
class WordError(Exception):
def __init__(self, w):
self.message = "Your word is '%s!' Try again!" % w
super().__init__(self.message)
word = input("Enter your word here: ")
try:
if word == "pig":
raise WordError(word)
elif word == "cup":
raise WordError(word)
else:
print(word)
except WordError as err:
print(err)