#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    S = input()

    ans = 0

    for i in range(10**4):
        if '0011' in S:
            ans += 4 * S.count('0011')
            S = S.replace('0011', '')
        if '1010' in S:
            ans += 4 * S.count('1010')
            S = S.replace('1010', '')
        if '0101' in S:
            ans += 4 * S.count('0101')
            S = S.replace('0101', '')
        if '1100' in S:
            ans += 4 * S.count('1100')
            S = S.replace('1100', '')
    for i in range(10**4):
        if '01' in S:
            ans += 2 * S.count('01')
            S = S.replace('01', '')
        if '10' in S:
            ans += 2 * S.count('10')
            S = S.replace('10', '')
    print(ans)

if __name__ == '__main__':
    main()
