A keyboard logger stores every key press, in order, as the string s. Reading the log from the start, find the first press of a key that had already been pressed earlier, and return that character. Capital and small letters are different keys, and spaces and punctuation are keys like any other. If no key is ever pressed twice, return "".
Examples
Input: s = "abcba"
Output: "b"
Input: s = "abcdef"
Output: ""
Constraints
0 <= len(s) <= 5000smay contain any printable characters
Goals
- Remember characters already seen
- Stop at the first character that was seen before
- Return a sentinel when nothing repeats