A character double occurs when the same character occurs twi
A character double occurs when the same character occurs twice in a row, such as the \"bb\" in \"hobbit\". Note the character could be a symbol, such as \"++\" or \"!!\". For example, the words below all contain character doubles. good hello C++ HOBBIT. Write a full program (starting from #include) that counts the number of character doubles in a phrase entered by the user. The output should look like the example below. Note there are 3 character doubles in this example input: \"bb\", \"oo\", and \"!!\" Enter phrase: Hobbits love cookies!! There are 3 character doubles. You do not have to worry about detecting upper vs. lower-case letters, nor do you have to handle the case when a character occurs three times or more in a row
Solution
t=input()
r=t.split()
c=0
for i in range(0,len(r)):
r1=r[i];
for j in range(0,len(r1)-1):
if(r1[j]==r1[j+1]):
c=c+1;
else:
continue;
print(c)
