+ 3

[Challenge🏆🏆🏆] Print index of '0' in string

given a string as input, print the index of the first, second and third occurrence of 0 in the string or else print "not found". you have to use indexOf to solve this problem and cannot use for loop and charAt. test case:-1 Input:----"9810098100" Expected output:---- first:3 second:4 third:8 test case:2 input:---"0" Expected output:----- first:0 not found test case:3 input:---"10101" Expected output:------- first:1 second:3 not found

10th Oct 2017, 2:04 AM
Sahil Luthra
Sahil Luthra - avatar
3 ответов
+ 3
@Cpasgrave this is showing error in line 1st
12th Oct 2017, 10:37 AM
Sahil Luthra
Sahil Luthra - avatar
+ 2
@Sahik Luthra Thank you Sahil, I wrote it on pc and forgot to modify for codeplayground. Just corrected it. Now it works.
12th Oct 2017, 11:25 AM
Cépagrave
Cépagrave - avatar
+ 1
I don't know java, wrote it with python : https://code.sololearn.com/cNmAaHssrtmW/?ref=app
10th Oct 2017, 11:19 AM
Cépagrave
Cépagrave - avatar