tc = int(input())
for t in range(1, tc + 1):
    n = input()
    res = 0
    cur = 0

    for i in range(len(n)):
        if cur != int(n[i]):
            cur = int(n[i])
            res = res + 1

    print("#{} {}".format(t, res))
43c5bb86ac183d1c245ad9eaf359ec9e5b23c454
<mask token>

<mask token>
for t in range(1, tc + 1):
    n = input()
    res = 0
    cur = 0
    for i in range(len(n)):
        if cur != int(n[i]):
            cur = int(n[i])
            res = res + 1
    print('#{} {}'.format(t, res))

tc = int(input())
for t in range(1, tc + 1):
    n = input()
    res = 0
    cur = 0
    for i in range(len(n)):
        if cur != int(n[i]):
            cur = int(n[i])
            res = res + 1
    print('#{} {}'.format(t, res))

tc = int(input())
for t in range(1, tc + 1):
    n = input()
    res = 0
    cur = 0

    for i in range(len(n)):
        if cur != int(n[i]):
            cur = int(n[i])
            res = res + 1

    print("#{} {}".format(t, res))