Cody

Solution 1980180

Submitted on 17 Oct 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = 'left3down2'; y_correct = 'left[3]down[2]'; assert(strcmp(nestedNums(x),y_correct))

x = 'left[3]down2' x = 'left[3]down[2]' y = 'left[3]down[2]'

2   Pass
x = 'fiat500'; y_correct = 'fiat[500]'; assert(strcmp(nestedNums(x),y_correct))

x = 'fiat[500]' y = 'fiat[500]'

3   Pass
x = 'no numbers here'; y_correct = 'no numbers here'; assert(strcmp(nestedNums(x),y_correct))

y = 'no numbers here'

4   Pass
x = '1234567890'; y_correct = '[1234567890]'; assert(strcmp(nestedNums(x),y_correct))

x = '[1234567890]' y = '[1234567890]'

5   Fail
x = 'var1 = 20; var2 = 47; var3 = 59;'; y_correct = 'var[1] = [20]; var[2] = [47]; var[3] = [59];'; assert(strcmp(nestedNums(x),y_correct))

x = 'var[1] = 20; var2 = 47; var3 = 59;' x = 'var[1] = [20]; var2 = 47; var3 = 59;' x = 'var[1] = [[2]0]; var[2] = 47; var3 = 59;' x = 'var[1] = [[2]0]; var[2] = [47]; var3 = 59;' x = 'var[1] = [[2]0]; var[2] = [47]; var[3] = 59;' x = 'var[1] = [[2]0]; var[2] = [47]; var[3] = [59];' y = 'var[1] = [[2]0]; var[2] = [47]; var[3] = [59];'

Assertion failed.

6   Fail
x = '14et38z1n541z8ne'; y_correct = '[14]et[38]z[1]n[541]z[8]ne'; assert(strcmp(nestedNums(x),y_correct))

x = '[14]et38z1n541z8ne' x = '[14]et[38]z1n541z8ne' x = '[[1]4]et[38]z[1]n54[1]z8ne' x = '[[1]4]et[38]z[1]n54[1]z8ne' x = '[[1]4]et[3[8]]z[1]n54[1]z[8]ne' y = '[[1]4]et[3[8]]z[1]n54[1]z[8]ne'

Assertion failed.

Suggested Problems

More from this Author10