Buggy python submission (verdict: Runtime Error):
while 1:
        n = input()
        if n == 0: break
        for i in range(n):
                if i == 0: ns = str(input())
                else: pass
                temp = ''
                count = 1
                for i in range(len(ns)-1):
                        if ns[i] == ns[i+1]:
                                count += 1
                        else:
                                temp += str(count)+ns[i]
                                count = 1
                temp += str(count)+ns[-1]
                ns = temp
        print ns

Fixed submission:
while 1:
        n = input()
        if n == 0: break
        for j in range(n):
                if j == 0: ns = raw_input()
                temp = ''
                count = 1
                for i in range(len(ns)-1):
                        if ns[i] == ns[i+1]:
                                count += 1
                        else:
                                temp += str(count)+ns[i]
                                count = 1
                temp += str(count)+ns[-1]
                ns = temp
        print ns

Buggy python submission (verdict: Runtime Error):
while 1:
        n = input()
        if n == 0: break
        for i in range(n):
                if i == 0: ns = str(input())
                temp = ''
                count = 1
                for i in range(len(ns)-1):
                        if ns[i] == ns[i+1]:
                                count += 1
                        else:
                                temp += str(count)+ns[i]
                                count = 1
                temp += str(count)+ns[-1]
                ns = temp
        print ns

Fixed submission:
while 1:
        n = input()
        if n == 0: break
        for j in range(n):
                if j == 0: ns = raw_input()
                temp = ''
                count = 1
                for i in range(len(ns)-1):
                        if ns[i] == ns[i+1]:
                                count += 1
                        else:
                                temp += str(count)+ns[i]
                                count = 1
                temp += str(count)+ns[-1]
                ns = temp
        print ns

Buggy python submission (verdict: Runtime Error):
while 1:
        n = input()
        if n == 0: break
        for i in range(n):
                if i == 0: ns = str(input())
                temp = ''
                count = 1
                for i in range(len(ns)-1):
                        if ns[i] == ns[i+1]:
                                count += 1
                        else:
                                temp += str(count)+ns[i]
                                count = 1
                temp += str(count)+ns[-1]
                ns = temp
        print ns

Fixed submission:
while 1:
        n = input()
        if n == 0: break
        for j in range(n):
                if j == 0: ns = raw_input()
                temp = ''
                count = 1
                for i in range(len(ns)-1):
                        if ns[i] == ns[i+1]:
                                count += 1
                        else:
                                temp += str(count)+ns[i]
                                count = 1
                temp += str(count)+ns[-1]
                ns = temp
        print ns

Buggy python submission (verdict: Runtime Error):
while 1:
        n = input()
        if n == 0: break
        for j in range(n):
                if j == 0: ns = str(input())
                temp = ''
                count = 1
                for i in range(len(ns)-1):
                        if ns[i] == ns[i+1]:
                                count += 1
                        else:
                                temp += str(count)+ns[i]
                                count = 1
                temp += str(count)+ns[-1]
                ns = temp
        print ns

Fixed submission:
while 1:
        n = input()
        if n == 0: break
        for j in range(n):
                if j == 0: ns = raw_input()
                temp = ''
                count = 1
                for i in range(len(ns)-1):
                        if ns[i] == ns[i+1]:
                                count += 1
                        else:
                                temp += str(count)+ns[i]
                                count = 1
                temp += str(count)+ns[-1]
                ns = temp
        print ns