Your examples are pretty useful (especially
'Aardvark'), and should be included in the documentation of the function, ideally as a
doctest. However, the problem is still underspecified: what should happen when a streak of three identical characters is encountered? Should
'eek' (which is how I would interpret "doubles"), or
'ek' (which is what your code actually does)?
As per PEP 8, the official Python style guide, function names should be
lower_case_with_underscores unless you have a good reason to deviate. Therefore, I recommend renaming the function to
' ' and then dropping it with
output[1:] is cumbersome and inefficient.
Fundamentally, this operation is a fancy string substitution. Typically, such substitutions are best done using regular expressions. In particular, you need the backreferences feature:
Backreferences in a pattern allow you to specify that the contents of an earlier capturing group must also be found at the current location in the string. For example,
\1 will succeed if the exact contents of group 1 can be found at the current position, and fails otherwise. Remember that Python’s string literals also use a backslash followed by numbers to allow including arbitrary characters in a string, so be sure to use a raw string when incorporating backreferences in a RE.
For example, the following RE detects doubled words in a string.
>>> p = re.compile(r'(\b\w+)\s+\1')
>>> p.search('Paris in the the spring').group()
For my interpretation of "doubles":
For each consecutive pair of the same character (case-insensitive),
drop the second character.
return re.sub(r'(.)\1', r'\1', string, flags=re.I)
To preserve your implementation's behaviour:
For each consecutive streak of the same character (case-insensitive),
drop all but the first character.
return re.sub(r'(.)\1+', r'\1', string, flags=re.I)