Given a string s, return the first character that appears for the second time while reading left to right. Comparison is case-sensitive and every character counts (spaces and punctuation too). If no character repeats, 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