Cody

# Problem 3019. Calculator spelling - Letters to Numbers

Solution 1967437

Submitted on 8 Oct 2019 by Augusto Mazzei
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))

a = 30000 a = 35000 a = 35000 a = 35000 a = 35007 n = 35007

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

a = 70000 a = 77000 a = 77300 a = 77340 a = 77345 n = 77345

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

a = 30000 a = 36000 a = 36100 a = 36130 a = 36138 n = 36138

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

a = 300000 a = 370000 a = 378000 a = 378800 a = 378800 a = 378806 n = 378806

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

a = 300000 a = 370000 a = 376000 a = 376000 a = 376000 a = 376006 n = 376006

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

a = 5.0000e+10 a = 5.7000e+10 a = 5.7700e+10 a = 5.7730e+10 a = 5.7738e+10 a = 5.7738e+10 a = 5.7738e+10 a = 5.7738e+10 a = 5.7738e+10 a = 5.7738e+10 a = 5.7738e+10 n = 5.7738e+10

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

a = 0 a = 0.7000 a = 0.7700 a = 0.7730 a = 0.7734 n = 0.7734

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

a = 50000 a = 53000 a = 53000 a = 53040 a = 53045 n = 53045

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

a = 700 a = 770 a = 771 n = 771

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

a = 300 a = 340 a = 345 n = 345

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

a = 7000 a = 7700 a = 7730 a = 7735 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))

a = 7000 a = 7700 a = 7710 a = 7714 n = 7714

### Community Treasure Hunt

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

Start Hunting!