Given two strings s and t, which contain only lowercase letters.
String rearrangement t s by the random string, and add a letter at random locations.
Find the letters are added in t.
Example:
输入:
s = "abcd"
t = "abcde"
Output:
E
Interpretation:
'E' that is being added letters.
solution:
func findTheDifference(_ s: String, _ t: String) -> Character {
var s = s
for item in t {
if let index = s.firstIndex(of: item) {
s.remove(at: index)
}else{
return item
}
}
return Character("")
}