Cody

Problem 44697. count upper and lower case characters

Solution 1742330

Submitted on 4 Mar 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   Fail
str = 'This is a Test Case'; ans_corr = [3 12]; assert(isequal(counter_ul(str),ans_corr))

u = 0 l = 0 u = 1 u = 2 u = 3 u = 4 u = 5 u = 6 u = 7 u = 8 u = 9 u = 10 u = 11 l = 1 u = 12 u = 13 u = 14 y = 14 1

Assertion failed.

2   Fail
str = 'RandoM'; ans_corr = [2 4]; assert(isequal(counter_ul(str),ans_corr))

u = 0 l = 0 u = 1 u = 2 u = 3 u = 4 u = 5 l = 1 y = 5 1

Assertion failed.

3   Fail
str = 'Hello World'; ans_corr = [2 8]; assert(isequal(counter_ul(str),ans_corr))

u = 0 l = 0 l = 1 u = 1 u = 2 u = 3 u = 4 u = 5 u = 6 u = 7 u = 8 u = 9 y = 9 1

Assertion failed.

4   Fail
str = 'HELLO WORLD'; ans_corr = [10 0]; assert(isequal(counter_ul(str),ans_corr))

u = 0 l = 0 l = 1 l = 2 l = 3 l = 4 l = 5 u = 1 l = 6 u = 2 l = 7 l = 8 y = 2 8

Assertion failed.

5   Fail
str = 'hello world'; ans_corr = [0 10]; assert(isequal(counter_ul(str),ans_corr))

u = 0 l = 0 u = 1 u = 2 u = 3 u = 4 u = 5 u = 6 u = 7 u = 8 u = 9 u = 10 y = 10 0

Assertion failed.

6   Fail
str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; ans_corr = [26 0]; assert(isequal(counter_ul(str),ans_corr))

u = 0 l = 0 l = 1 l = 2 l = 3 l = 4 l = 5 l = 6 l = 7 l = 8 l = 9 l = 10 l = 11 l = 12 l = 13 l = 14 l = 15 l = 16 u = 1 u = 2 u = 3 u = 4 u = 5 u = 6 u = 7 u = 8 u = 9 u = 10 y = 10 16

Assertion failed.

7   Fail
str = 'abcdefghijklmnopqrstuvwxyz'; ans_corr = [0 26]; assert(isequal(counter_ul(str),ans_corr))

u = 0 l = 0 u = 1 u = 2 u = 3 u = 4 u = 5 u = 6 u = 7 u = 8 u = 9 u = 10 u = 11 u = 12 u = 13 u = 14 u = 15 u = 16 u = 17 u = 18 u = 19 u = 20 u = 21 u = 22 u = 23 u = 24 u = 25 u = 26 y = 26 0

Assertion failed.

8   Fail
str = '42'; ans_corr = [0 0]; assert(isequal(counter_ul(str),ans_corr))

u = 0 l = 0 l = 1 l = 2 y = 0 2

Assertion failed.

9   Fail
str = 'Matlab'; ans_corr = [1 5]; assert(isequal(counter_ul(str),ans_corr))

u = 0 l = 0 l = 1 u = 1 u = 2 u = 3 u = 4 u = 5 y = 5 1

Assertion failed.