All problems

Problem 834

Find the Difference

Easy · 10 pts · String, Hash Table, Bit Manipulation

Problem

String T was made by shuffling string S and then inserting one extra letter at a random position. Find the letter that was added. Counting letters works, but there is a neat trick: XOR together the codes of all characters of both strings; every letter of S cancels with its copy in T, and only the added letter remains. Adding up the codes and subtracting also works.

Input

The first line contains S. The second line contains T. Both use lowercase letters, and S may be empty (then the first line contains only a dash -).

Output

Print the added letter.

Constraints

0 <= |S| <= 1000; |T| = |S| + 1

Example input

abcd
abcde

Example output

e

Explanation

S = abcd and T = abcde contain the same letters except for e, so the added letter is e.

Every problem here can be used in a RelayTrixCode team match. Create a room.

Previous: Unique Morse Code Words Next: Long Pressed Name