z-passwd
Mister Little Z. and his friend Mister S. went to an important business meeting. Since they knew they were going to sit far apart on the table, but they still wanted to be able to communicate without other people understanding what they are saying. They came up with the following method:
Whenever Mister S. wants to say something, he encrypts the word by some algorithm that only he and Mister Little Z. know. Also Mister Little Z. decrypts all the words that Mister S. is saying.
However, they forgot one important thing! Well, since mister Little Z. decrypts all the words that Mister S. is saying, he actually doesn't know which ones are the ones that Mister S is saying to Mister Little Z and not to other people.
.For example, Mister S. wants to say the following words to everyone: "good", "morning", and he wants to say the following words to mister Little Z: "they", "are", "late". After Mister Little Z hears all the words, and decrypts them, he has the following words: "grandmother", "bird", "they", "are", "late". The first two words are totally wrong since Mister S. didn't encrypt them (he wanted everyone to understand them), and after Mister Little Z. decrypted them he got totally different words
Now, you know all the words that Mister S. has said during the meeting (before he has encrypted them). And you also know all the words that Mister Little Z. has heard (after he has decrypted them. You have to find how many words Mister S. actually wanted to say only to Mister Little Z.
You only have the list of words, they are not necessarily in the order that Mister S. has said them, or that Mister Z. had heard them
Input:
5
hi
everyone
they
are
ugly
they
pig
frog
ugly
areOutput:
3Explanation: The words that Mister S. said to Mister Little Z are "they", "are", and "ugly", and the words that Mister S. said to everyone are "hi" and "everyone". So, Mister Little Z decrypted the three words "they" "are" and "ugly" correctly. Mister Little Z obtained the words "pig" and "frog" by decrypting words that were not encrypted.
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.