Buggy python submission (verdict: Runtime Error):
S = input()
dp = [-1, -1]*len(S)


def solve(s):
    l = len(s)
    if dp[l-1] != -1:
        return dp[l-1]
    else:

        if l >= 2:
            dp[l-2] = solve(s[:-1])
        else:
            dp[0] = [1, 1]
            return dp[0]
        if s[-1] != s[-2]:
            if dp[l-2][1] == 2 and s[-2] == s[-3]:
                dp[l-1] = [dp[l-2][0] + 1, 2]
            else:
                dp[l-1] = [dp[l-2][0] + 1, 1]
        else:
            if dp[l-2][1] == 2:
                dp[l-1] = [dp[l-2][0] + 1, 1]
            else:
                dp[l-1] = [dp[l-2][0], 2]

        return dp[l-1]


ans = solve(S)
print(ans[0])


Fixed submission:
S = input()
ans = []

prev = ""
now = ""
for i in range(len(S)):
    now = now + S[i]
    if now != prev:
        ans.append(now)
        prev = now
        now = ""


print(len(ans))

Buggy python submission (verdict: Runtime Error):
S = input()
dp = [-1, -1]*len(S)


def solve(s):
    l = len(s)
    if dp[l-1] != -1:
        return dp[l-1]
    else:

        if l >= 2:
            dp[l-2] = solve(s[:-1])
        else:
            dp[0] = [1, 1]
            return dp[0]
        if s[-1] != s[-2]:
            if dp[l-2][1] == 2:
                dp[l-1] = [dp[l-2][0] + 1, 2]
            else:
                dp[l-1] = [dp[l-2][0] + 1, 1]
        else:
            if dp[l-2][1] == 2:
                dp[l-1] = [dp[l-2][0] + 1, 1]
            else:
                dp[l-1] = [dp[l-2][0], 2]

        return dp[l-1]


ans = solve(S)
print(ans[0])


Fixed submission:
S = input()
ans = []

prev = ""
now = ""
for i in range(len(S)):
    now = now + S[i]
    if now != prev:
        ans.append(now)
        prev = now
        now = ""


print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import copy
import itertools
S = input()

K = 0
S__ = []
flag = False
prev = -1
for i in range(len(S)):
    S_ = list(itertools.combinations(range(len(S) - 1), i))
    for j in S_:
        if len(j) == 0:
            continue
        else:
            index = 0
            S__ = []
            buff = ""
            for k in range(len(S)):
                buff += S[k]
                if index >= len(j):
                    buff += S[k+1:]
                    S__.append(buff)
                    break
                if k == j[index]:
                    S__.append(buff)
                    buff = ""
                    index += 1
                    continue
            for k in range(len(S__) - 1):
                if S__[k] == S__[k + 1]:
                    break
                elif k == len(S__) - 2:
                    K = len(S__)
                    flag = True
            if flag:
                flag = False
                break
    if K == prev:
        print(K)
        exit(0)
    else:
        prev = K
    




    


Fixed submission:
S = input()
ans = []

prev = ""
now = ""
for i in range(len(S)):
    now = now + S[i]
    if now != prev:
        ans.append(now)
        prev = now
        now = ""


print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import copy
import itertools
S = input()

K = 0
S__ = []

for i in reversed(range(len(S))):
    S_ = list(itertools.combinations(range(len(S) - 1), i))
    for j in S_:
        j = list(j)

        index = 0
        buff = ""
        S__ = []
        for k in range(len(S)):
            if index >= len(j):
                buff += S[k:]
                S__.append(buff)
                buff = ""
                break
            buff += S[k]

            if k == j[index]:
                S__.append(buff)
                buff = ""
                index += 1

        for k in range(len(S__) - 1):
            if S__[k] != S__[k+1]:
                if k == len(S__) - 2:
                    print(len(S__))
                    exit(0)
            else:
                break

Fixed submission:
S = input()
ans = []

prev = ""
now = ""
for i in range(len(S)):
    now = now + S[i]
    if now != prev:
        ans.append(now)
        prev = now
        now = ""


print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import copy
import itertools
S = input()

K = 0
S__ = []

for i in reversed(range(len(S))):
    S_ = list(itertools.combinations(range(len(S) - 1), i))
    for j in S_:
        j = list(j)

        index = 0
        buff = ""
        S__ = []
        for k in range(len(S)):
            if index >= len(j):
                buff += S[k:]
                S__.append(buff)
                buff = ""
                break
            buff += S[k]

            if k == j[index]:
                S__.append(buff)
                buff = ""
                index += 1

        for k in range(len(S__) - 1):
            if S__[k] != S__[k+1]:
                if k == len(S__) - 2:
                    print(len(S__))
                    exit(0)
            else:
                break






    

Fixed submission:
S = input()
ans = []

prev = ""
now = ""
for i in range(len(S)):
    now = now + S[i]
    if now != prev:
        ans.append(now)
        prev = now
        now = ""


print(len(ans))