Cody

# Problem 1579. How many digits are there?

Solution 1634884

Submitted on 28 Sep 2018 by Michael Jarboe
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 = 'anbduybefiafn29128r4 ybzw'; y_correct = 6; assert(isequal(digits(x),y_correct))

n = 0 n = 1 n = 3 n = 3 n = 4 n = 4 n = 4 n = 4 n = 5 n = 6

2   Pass
x = 'anuk32y7rhcscbniv82 bv7hf bA^#2tR*Gqvg'; y_correct = 7; assert(isequal(digits(x),y_correct))

n = 0 n = 0 n = 3 n = 4 n = 4 n = 4 n = 4 n = 6 n = 7 n = 7

3   Pass
x = '1234567890'; y_correct = 10; assert(isequal(digits(x),y_correct))

n = 1 n = 2 n = 3 n = 4 n = 5 n = 6 n = 7 n = 8 n = 9 n = 10

4   Pass
x = 'a1b2c3d4e5f6g7h8i9'; y_correct = 9; assert(isequal(digits(x),y_correct))

n = 0 n = 1 n = 2 n = 3 n = 4 n = 5 n = 6 n = 7 n = 8 n = 9

5   Pass
x = 's;dfj98798324k kds \$:J(%*n 34 ;ljkasr87 34w ;lkj3 aoij5l;j;q 35'; y_correct = 18; assert(isequal(digits(x),y_correct))

n = 0 n = 0 n = 1 n = 6 n = 9 n = 11 n = 11 n = 13 n = 16 n = 18

6   Pass
x = num2str(1:100); y_correct = 192; assert(isequal(digits(x),y_correct))

n = 11 n = 32 n = 52 n = 72 n = 92 n = 112 n = 132 n = 152 n = 172 n = 192

7   Pass
x = 'The answer is 42.'; y_correct = 2; assert(isequal(digits(x),y_correct))

n = 0 n = 0 n = 1 n = 1 n = 2 n = 2 n = 2 n = 2 n = 2 n = 2