Find and remove a typo that creates a repeated character in a word.
You are given a single word. Somewhere in the word, a typo may have occurred: one character was accidentally typed twice in a row.
Your task is to fix the word by removing exactly one character from a consecutive equal pair so that the resulting string matches the intended word.
If there is no such typo, the word should remain unchanged.
A typo is present if there exists an index such that s[i] == s[i+1]. In that case, remove one of these two equal characters in the most appropriate way so the word becomes valid again.
Example 1
Input
atttachment
Output
atttachment
Explanation
The repeated characters are part of the typo; removing one of the duplicated letters restores the intended word.
Example 2
Input
helllo
Output
hello
Explanation
The first repeated pair is ll, so removing one l fixes the word.
Example 3
Input
codeforces
Output
codeforces
Explanation
There is no adjacent duplicated character, so the string stays unchanged.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.