Given two strings s and t which consist of only lowercase letters.
String t is generated by random shuffling string s and then add one more letter at a random position.
Find the letter that was added in t.
Input: s = "abcd" t = "abcde" Output: e Explanation: 'e' is the letter that was added.
For problems of finding the difference, first think about XOR operation. Two points about XOR must be comfortable with:
- 0 ^ A = A
- XOR is commutable, so sequence not matters
Secondly, think about the length of s and t. t must have one more letter than s. Combined with the commutation of XOR, two XOR operations can be put under the same for loop.