-Code
for _ in range(int(input())):
num = input()
res = []
now_num = num[0]
cnt = 0
for n in num:
if now_num != n:
res.append([str(cnt), now_num])
now_num = n
cnt = 1
continue
cnt += 1
res.append([str(cnt), now_num])
res_line = ""
for el in res:
res_line += el[0] + el[1]
print(res_line)
'Beakjoon&프로그래머스 > 파이썬' 카테고리의 다른 글
[백준/파이썬] 31261번 I MADE UP A NUMBER (0) | 2024.01.17 |
---|---|
[백준/파이썬] 24088번 運動会 (Sports Day) (0) | 2024.01.16 |
[백준/파이썬] 6765번 Icon Scaling (0) | 2024.01.14 |
[백준/파이썬] 14322번 Country Leader (Small) (0) | 2024.01.13 |
[백준/파이썬] 18884번 New Year and Naming (0) | 2024.01.12 |