All problems

One-Hot Encoding a Single Value

easyPythonFeature Engineering

One of Quillon Energy's columns holds the customer's tariff name, which is text, and the model only takes numbers. Numbering the tariffs 1, 2, 3 would be a disaster: it would tell the model that tariff 3 is somehow three times tariff 1 and sits between tariff 2 and tariff 4, none of which means anything. So the column is replaced by one slot per tariff, all holding 0 except the slot for the customer's own tariff, which holds 1. That layout is called one-hot -- exactly one slot is lit. The slot order is fixed in advance and every tariff keeps its own slot.

Task: Print the one-hot slots for this customer's tariff.

Input

The first line holds one integer n, the number of tariffs. The second line holds the n tariff names in their fixed slot order, separated by single spaces; a name contains no spaces. The last line holds the customer's tariff, which is always one of the n names and must match one letter for letter.

Output

One line holding n values separated by single spaces, each either 0 or 1, in the fixed slot order.

Example:

Input:
3
red green blue
green

Output:
0 1 0

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…