def remove_consecutive_duplicates(_list: list):
preprocessed_list = []
for x in itertools.groupby(_list):
preprocessed_list.append(x[0])
return preprocessed_list
no_consecutive_duplicates = [x[0] for x in itertools.groupby(my_list)]
# Remove the Consecutive Duplicates string word:
# First System:
'''
s = input() #input: BBBBBPPIIAICCODEE
s2 = ""
prev = None
for chr in s:
if prev != chr:
s2 += chr
prev = chr
print(s2)
output: BPIAICODE
'''
# Second System:
# input: SSSWWWIIFTPPYTHOOOOOOOOONNNNNNNNN
def removeConsecutiveDuplicates(s):
if len(s) < 2:
return s
if s[0] != s[1]:
return s[0] + removeConsecutiveDuplicates(s[1:])
return removeConsecutiveDuplicates(s[1:])
# This code is contributed:
s1 = input()
print(removeConsecutiveDuplicates(s1))
# output: SWIFTPYTHON
# Remove the Consecutive Duplicates string word:
# First System:
#Example input: BBBBBPPIIAICCODEE
s = input()
s2 = ""
prev = None
for chr in s:
if prev != chr:
s2 += chr
prev = chr
print(s2)
output: BPIAICODE
# Second System:
# Example input: SSSWWWIIFTPPYTHOOOOOOOOONNNNNNNNN
'''
def removeConsecutiveDuplicates(s):
if len(s) < 2:
return s
if s[0] != s[1]:
return s[0] + removeConsecutiveDuplicates(s[1:])
return removeConsecutiveDuplicates(s[1:])
# This code is contributed:
s1 = input()
print(removeConsecutiveDuplicates(s1))
# output: SWIFTPYTHON
'''