Cody

Problem 3019. Calculator spelling - Letters to Numbers

Solution 1631677

Submitted on 21 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
n = 35007; word = 'LOOSE'; assert(isequal(calc_spell_num(word),n))

C = '012345678' L = 'OIZEhSgLB' word = 'L00SE' word = 'L00SE' word = 'L00SE' word = 'L00S3' word = 'L00S3' word = 'L0053' word = 'L0053' word = '70053' word = '70053' n = 35007

2   Pass
n = 77345; word = 'ShELL'; assert(isequal(calc_spell_num(word),n))

C = '012345678' L = 'OIZEhSgLB' word = 'ShELL' word = 'ShELL' word = 'ShELL' word = 'Sh3LL' word = 'S43LL' word = '543LL' word = '543LL' word = '54377' word = '54377' n = 77345

3   Pass
n = 36138; word = 'BEIgE'; assert(isequal(calc_spell_num(word),n))

C = '012345678' L = 'OIZEhSgLB' word = 'BEIgE' word = 'BE1gE' word = 'BE1gE' word = 'B31g3' word = 'B31g3' word = 'B31g3' word = 'B3163' word = 'B3163' word = '83163' n = 36138

4   Pass
n = 378806; word = 'gOBBLE'; assert(isequal(calc_spell_num(word),n))

C = '012345678' L = 'OIZEhSgLB' word = 'g0BBLE' word = 'g0BBLE' word = 'g0BBLE' word = 'g0BBL3' word = 'g0BBL3' word = 'g0BBL3' word = '60BBL3' word = '60BB73' word = '608873' n = 378806

5   Pass
n = 376006; word = 'gOOgLE'; assert(isequal(calc_spell_num(word),n))

C = '012345678' L = 'OIZEhSgLB' word = 'g00gLE' word = 'g00gLE' word = 'g00gLE' word = 'g00gL3' word = 'g00gL3' word = 'g00gL3' word = '6006L3' word = '600673' word = '600673' n = 376006

6   Pass
n = 57738461375; word = 'SLEIghBELLS'; assert(isequal(calc_spell_num(word),n))

C = '012345678' L = 'OIZEhSgLB' word = 'SLEIghBELLS' word = 'SLE1ghBELLS' word = 'SLE1ghBELLS' word = 'SL31ghB3LLS' word = 'SL31g4B3LLS' word = '5L31g4B3LL5' word = '5L3164B3LL5' word = '573164B3775' word = '57316483775' n = 5.7738e+10

7   Pass
n = 0.7734; word = 'hELLO'; assert(isequal(calc_spell_num(word),n))

C = '012345678' L = 'OIZEhSgLB' word = 'hELL0' word = 'hELL0' word = 'hELL0' word = 'h3LL0' word = '43LL0' word = '43LL0' word = '43LL0' word = '43770' word = '43770' n = '0.7734' n = 0.7734

8   Pass
n = 53045; word = 'ShOES'; assert(isequal(calc_spell_num(word),n))

C = '012345678' L = 'OIZEhSgLB' word = 'Sh0ES' word = 'Sh0ES' word = 'Sh0ES' word = 'Sh03S' word = 'S403S' word = '54035' word = '54035' word = '54035' word = '54035' n = 53045

9   Pass
n = 771; word = 'ILL'; assert(isequal(calc_spell_num(word),n))

C = '012345678' L = 'OIZEhSgLB' word = 'ILL' word = '1LL' word = '1LL' word = '1LL' word = '1LL' word = '1LL' word = '1LL' word = '177' word = '177' n = 771

10   Pass
n = 345; word = 'ShE'; assert(isequal(calc_spell_num(word),n))

C = '012345678' L = 'OIZEhSgLB' word = 'ShE' word = 'ShE' word = 'ShE' word = 'Sh3' word = 'S43' word = '543' word = '543' word = '543' word = '543' n = 345

11   Pass
n = 7735; word = 'SELL'; assert(isequal(calc_spell_num(word),n))

C = '012345678' L = 'OIZEhSgLB' word = 'SELL' word = 'SELL' word = 'SELL' word = 'S3LL' word = 'S3LL' word = '53LL' word = '53LL' word = '5377' word = '5377' n = 7735

12   Pass
ind = randi(4); n_arr = [36138 707 7714 57738]; n = n_arr(ind); word_arr = {'BEIgE','LOL','hILL','BELLS'}; word = word_arr{ind}; assert(isequal(calc_spell_num(word),n))

C = '012345678' L = 'OIZEhSgLB' word = 'L0L' word = 'L0L' word = 'L0L' word = 'L0L' word = 'L0L' word = 'L0L' word = 'L0L' word = '707' word = '707' n = 707

Suggested Problems

More from this Author139

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!