Challenge
Given a strings of any length which contains only digits from 0 to 9, replace each consecutive run of the digit 0 with its length.
Test Cases
1. string = '1234500362000440' output = '1234523623441'
2. string = '123450036200044' output = '123452362344'
3. string = '000000000000' output = '12'
4. string = '0123456789' output = '1123456789'
5. string = '1234567890' output = '1234567891'
6. string = '123456789' output = '123456789'
7. string = '010203004050' output = '11121324151'
1234500362000440→1234523623441123450036200044→123452362344000000000000→120123456789→11234567891234567890→1234567891123456789→123456789010203004050→11121324151
Note
The shortest answer in bytes wins as per code-golf rules
Challenge
Given a strings of any length which contains only digits from 0 to 9 replace each consecutive run of the digit 0 with its length.
Test Cases
1. string = '1234500362000440' output = '1234523623441'
2. string = '123450036200044' output = '123452362344'
3. string = '000000000000' output = '12'
4. string = '0123456789' output = '1123456789'
5. string = '1234567890' output = '1234567891'
6. string = '123456789' output = '123456789'
7. string = '010203004050' output = '11121324151'
Note
The shortest answer in bytes wins as per code-golf rules
Challenge
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.
Test Cases
1234500362000440→1234523623441123450036200044→123452362344000000000000→120123456789→11234567891234567890→1234567891123456789→123456789010203004050→11121324151
Note
The shortest answer in bytes wins as per code-golf rules
Replace 0 with the consecutive counts in an string0s In a String With Their Consecutive Counts
Challenge
Challenge
Given a string s of any length which contains only digits from 0 to 9. You have to replace each consecutive run of the digit 0 with its consecutive count.Assuming all the character of the given string contains digits from0 to 9 onlylength.
Test Cases
Test Cases
1. string = '1234500362000440' output = '1234523623441'
2. string = '123450036200044' output = '123452362344'
3. string = '000000000000' output = '12'
4. string = '0123456789' output = '1123456789'
5. string = '1234567890' output = '1234567891'
6. string = '123456789' output = '123456789'
7. string = '010203004050' output = '11121324151'
Note
Note
The shortest answer in bytes wins as per code-golfcode-golf rules
Replace 0 with the consecutive counts in an string
Challenge
Given a string s of any length which contains only digits from 0 to 9. You have to replace the 0 with its consecutive count.Assuming all the character of the given string contains digits from0 to 9 only.
Test Cases
1. string = '1234500362000440' output = '1234523623441'
2. string = '123450036200044' output = '123452362344'
3. string = '000000000000' output = '12'
4. string = '0123456789' output = '1123456789'
5. string = '1234567890' output = '1234567891'
6. string = '123456789' output = '123456789'
7. string = '010203004050' output = '11121324151'
Note
The shortest answer in bytes wins as per code-golf rules
Replace 0s In a String With Their Consecutive Counts
Challenge
Given a string s of any length which contains only digits from 0 to 9 replace each consecutive run of the digit 0 with its length.
Test Cases
1. string = '1234500362000440' output = '1234523623441'
2. string = '123450036200044' output = '123452362344'
3. string = '000000000000' output = '12'
4. string = '0123456789' output = '1123456789'
5. string = '1234567890' output = '1234567891'
6. string = '123456789' output = '123456789'
7. string = '010203004050' output = '11121324151'
Note
The shortest answer in bytes wins as per code-golf rules
Replace 0 with the consecutive counts in an string
Challenge
Given a string s of any length which contains only digits from 0 to 9. You have to replace the 0 with its consecutive count.Assuming all the character of the given string contains digits from0 to 9 only.
Test Cases
1. string = '1234500362000440' output = '1234523623441'
2. string = '123450036200044' output = '123452362344'
3. string = '000000000000' output = '12'
4. string = '0123456789' output = '1123456789'
5. string = '1234567890' output = '1234567891'
6. string = '123456789' output = '123456789'
7. string = '010203004050' output = '11121324151'
Note
The shortest answer in bytes wins as per code-golf rules