Describe the Digits
In the look-and-say sequence, each new term describes groups of equal digits in the previous string. For example, 21 is read as “one 2, one 1”, so the next term is 1211. Write a function look_and_say that takes a digit string s and returns the next term. Count only consecutive runs of the same digit, not all matching digits across the whole string.
Примеры
Ввод
"1"Вывод
"11"Ввод
"11"Вывод
"21"Ввод
"21"Вывод
"1211"Нужно реализовать
def look_and_say(s: str) -> str:
Теги
strings
Entre para ver seu histórico de envios
EntrarEntre para usar o AI Mentor
EntrarVisible tests
1
Input
"1"Expected
"11"2
Input
"11"Expected
"21"3
Input
"21"Expected
"1211"4
Input
"1211"Expected
"111221"5
Input
"111221"Expected
"312211"6
Input
""Expected
""Focus radio
Paused · SomaFM · Fluid