"""
What slice would remove the first and last characters
from a string s?

What index would access the middle character from a
string s? (You can assume it has odd length).

What expression would produce a 'doubled' version of a string s;
for example, the string "coding" would become "codcodinging"?
"""

s = "codingy"
print(s[1:len(s)-1])
print(s[len(s)//2])
print(s[0:len(s)//2]*2 + s[len(s)//2:len(s)]*2)

###

def countDoubleLetters(s):
    count = 0
    for i in range(len(s)-1):
        nextIndex = i+1
        if s[i] == s[nextIndex]:
            count = count + 1
    return count
    
assert(countDoubleLetters("bookkeeper") == 3)