sertunc / ReplaceZerosExample

Given a string of any length which contains only digits from 0 to 9, replace each consecutive run of the digit 0 with its length.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReplaceZerosExample

Given a string of any length which contains only digits from 0 to 9, replace each consecutive run of the digit 0 with its length.

replaceZeros("1234500362000440"); // 1234523623441

replaceZeros("123450036200044"); // 123452362344

replaceZeros("000000000000"); // 12

replaceZeros("123456789"); // 123456789

About

Given a string of any length which contains only digits from 0 to 9, replace each consecutive run of the digit 0 with its length.


Languages

Language:C# 100.0%