0% found this document useful (0 votes)
27 views2 pages

Harry Potter Spell Casting Challenge

Harry Potter must cast a spell using combinations of spells from his Hogwarts spell book to defeat Voldemort. The input consists of the number of spells, the spells themselves, and the spell Harry casts. The output determines if Harry or Voldemort wins based on whether Harry's cast is a valid combination of the spells taught to him.

Uploaded by

wemane3787
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views2 pages

Harry Potter Spell Casting Challenge

Harry Potter must cast a spell using combinations of spells from his Hogwarts spell book to defeat Voldemort. The input consists of the number of spells, the spells themselves, and the spell Harry casts. The output determines if Harry or Voldemort wins based on whether Harry's cast is a valid combination of the spells taught to him.

Uploaded by

wemane3787
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Spell Caster Harry Potter

Spell Caster
Harry is getting ready to fight the dark lord Voldemort. To win, Harry has to successfully cast a
Spell which is a combination of (zero or more) spells he was taught at [Link] he casts
anything else not in the spell book, Voldemort will win in the fight against Harry potter.

Can you help Harry figure out if the spell he casts can make him win against Voldemort?

Input:

Each Input contains 3 lines


Line 1: Number of spells in the spell book.
Line 2: The spell book itself - each spell is space separated.
Line 3: The spell Harry casts (No space separation).

All spells will be in lowercase letters.


Harry can repeat spells.

Output:
Winner of the contest. If Harry casts a combination of Spell taught at Hogwarts, the winner is
Harry, otherwise, the winner is Voldemort.
======================================================================
Example 1:

Input:
3
alohomora lumos accio
lumosaccio

Output:
Harry
======================================================================
Example 2:

Input:
3
expelliarmus expectopatronum accio
accioeexpelliarmus
Output:
Voldemort
======================================================================
Spell Caster Harry Potter

Example 3:

Input:
2
lumos oscuro
lumoscuro

Output:
Voldemort

You might also like