Cody

Problem 1901. GJam 2014 China Rd A: Read Phone Number

Solution 613101

Submitted on 7 Apr 2015
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
%% tic zstr='1'; zv=[1 ]; vexp='one'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

2   Pass
%% zstr='22'; zv=[2 ]; vexp='double two'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

3   Pass
%% zstr='333'; zv=[3 ]; vexp='triple three'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

4   Pass
%% zstr='4444'; zv=[4 ]; vexp='quadruple four'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

5   Pass
%% zstr='55555'; zv=[5 ]; vexp='quintuple five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

6   Pass
%% zstr='666666'; zv=[6 ]; vexp='sextuple six'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

7   Pass
%% zstr='7777777'; zv=[7 ]; vexp='septuple seven'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

8   Pass
%% zstr='88888888'; zv=[8 ]; vexp='octuple eight'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

9   Pass
%% zstr='999999999'; zv=[9 ]; vexp='nonuple nine'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

10   Pass
%% zstr='0000000000'; zv=[10 ]; vexp='decuple zero'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

11   Fail
%% zstr='1111111111'; zv=[1 1 1 1 1 1 1 1 1 1 ]; vexp='one one one one one one one one one one'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

12   Pass
%% zstr='1111111111'; zv=[1 2 3 4 ]; vexp='one double one triple one quadruple one'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

13   Pass
%% zstr='6701604014'; zv=[1 4 5 ]; vexp='six seven zero one six zero four zero one four'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

14   Pass
%% zstr='4096453178'; zv=[8 2 ]; vexp='four zero nine six four five three one seven eight'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

15   Pass
%% zstr='5418148180'; zv=[5 3 2 ]; vexp='five four one eight one four eight one eight zero'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

16   Pass
%% zstr='2319652041'; zv=[8 2 ]; vexp='two three one nine six five two zero four one'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

17   Fail
%% zstr='9645684646'; zv=[6 2 1 1 ]; vexp='nine six four five six eight four six four six'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

18   Pass
%% zstr='4508456969'; zv=[5 3 2 ]; vexp='four five zero eight four five six nine six nine'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

19   Fail
%% zstr='1839791609'; zv=[5 1 3 1 ]; vexp='one eight three nine seven nine one six zero nine'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

20   Fail
%% zstr='9398750802'; zv=[1 1 1 4 2 1 ]; vexp='nine three nine eight seven five zero eight zero two'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

21   Fail
%% zstr='5263950835'; zv=[4 5 1 ]; vexp='five two six three nine five zero eight three five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

22   Fail
%% zstr='1456187089'; zv=[3 6 1 ]; vexp='one four five six one eight seven zero eight nine'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

23   Pass
%% zstr='64360690'; zv=[8 ]; vexp='six four three six zero six nine zero'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

24   Fail
%% zstr='7367'; zv=[2 1 1 ]; vexp='seven three six seven'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

25   Pass
%% zstr='2441739'; zv=[5 2 ]; vexp='two double four one seven three nine'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

26   Fail
%% zstr='7532179'; zv=[1 1 2 2 1 ]; vexp='seven five three two one seven nine'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

27   Pass
%% zstr='0850664'; zv=[3 4 ]; vexp='zero eight five zero double six four'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

28   Pass
%% zstr='8013334'; zv=[5 2 ]; vexp='eight zero one double three three four'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

29   Fail
%% zstr='0184088'; zv=[2 1 4 ]; vexp='zero one eight four zero double eight'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

30   Fail
%% zstr='706181428'; zv=[4 4 1 ]; vexp='seven zero six one eight one four two eight'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

31   Pass
%% zstr='98530'; zv=[5 ]; vexp='nine eight five three zero'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

32   Pass
%% zstr='29664'; zv=[5 ]; vexp='two nine double six four'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

33   Pass
%% zstr='49502'; zv=[2 3 ]; vexp='four nine five zero two'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

34   Pass
%% zstr='15'; zv=[2 ]; vexp='one five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

35   Fail
%% zstr='562640038'; zv=[4 4 1 ]; vexp='five six two six four double zero three eight'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

36   Fail
%% zstr='1148979'; zv=[6 1 ]; vexp='double one four eight nine seven nine'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

37   Fail
%% zstr='79982'; zv=[3 1 1 ]; vexp='seven double nine eight two'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

38   Pass
%% zstr='769'; zv=[3 ]; vexp='seven six nine'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

39   Fail
%% zstr='1742234'; zv=[6 1 ]; vexp='one seven four double two three four'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

40   Fail
%% zstr='81818447'; zv=[5 1 1 1 ]; vexp='eight one eight one eight four four seven'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

41   Pass
%% zstr='5'; zv=[1 ]; vexp='five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

42   Pass
%% zstr='86'; zv=[2 ]; vexp='eight six'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

43   Fail
%% zstr='0573913609'; zv=[6 1 2 1 ]; vexp='zero five seven three nine one three six zero nine'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

44   Pass
%% zstr='497772738'; zv=[1 3 2 3 ]; vexp='four nine double seven seven two seven three eight'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

45   Fail
%% zstr='2252931'; zv=[1 5 1 ]; vexp='two two five two nine three one'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

46   Pass
%% zstr='19664'; zv=[3 2 ]; vexp='one nine six six four'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

47   Fail
%% zstr='566175'; zv=[5 1 ]; vexp='five double six one seven five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

48   Fail
%% zstr='92433'; zv=[4 1 ]; vexp='nine two four three three'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

49   Pass
%% zstr='912039567'; zv=[1 6 2 ]; vexp='nine one two zero three nine five six seven'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

50   Fail
%% zstr='4820841'; zv=[5 1 1 ]; vexp='four eight two zero eight four one'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

51   Fail
%% zstr='71'; zv=[1 1 ]; vexp='seven one'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

52   Fail
%% zstr='4690'; zv=[1 1 2 ]; vexp='four six nine zero'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

53   Pass
%% zstr='106624'; zv=[4 2 ]; vexp='one zero double six two four'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

54   Fail
%% zstr='7900005'; zv=[6 1 ]; vexp='seven nine quadruple zero five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

55   Fail
%% zstr='407'; zv=[2 1 ]; vexp='four zero seven'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

56   Fail
%% zstr='7738672895'; zv=[8 1 1 ]; vexp='double seven three eight six seven two eight nine five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

57   Fail
%% zstr='027326244'; zv=[2 2 4 1 ]; vexp='zero two seven three two six two four four'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

58   Fail
%% zstr='115855'; zv=[2 1 2 1 ]; vexp='double one five eight five five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

59   Fail
%% zstr='6553794'; zv=[5 1 1 ]; vexp='six double five three seven nine four'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

60   Fail
%% zstr='426185417'; zv=[8 1 ]; vexp='four two six one eight five four one seven'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

61   Fail
%% zstr='31'; zv=[1 1 ]; vexp='three one'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

62   Fail
%% zstr='68'; zv=[1 1 ]; vexp='six eight'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

63   Pass
%% zstr='05658716'; zv=[4 4 ]; vexp='zero five six five eight seven one six'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

64   Fail
%% zstr='87'; zv=[1 1 ]; vexp='eight seven'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

65   Pass
%% zstr='99329'; zv=[3 2 ]; vexp='double nine three two nine'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

66   Fail
%% zstr='21'; zv=[1 1 ]; vexp='two one'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

67   Fail
%% zstr='82'; zv=[1 1 ]; vexp='eight two'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

68   Fail
%% zstr='3273256549'; zv=[8 1 1 ]; vexp='three two seven three two five six five four nine'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

69   Pass
%% zstr='4'; zv=[1 ]; vexp='four'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

70   Pass
%% zstr='0'; zv=[1 ]; vexp='zero'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

71   Fail
%% zstr='780409'; zv=[4 1 1 ]; vexp='seven eight zero four zero nine'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

72   Pass
%% zstr='252966140'; zv=[4 3 2 ]; vexp='two five two nine double six one four zero'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

73   Pass
%% zstr='3416708243'; zv=[10 ]; vexp='three four one six seven zero eight two four three'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

74   Fail
%% zstr='715'; zv=[2 1 ]; vexp='seven one five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

75   Pass
%% zstr='714860127'; zv=[7 2 ]; vexp='seven one four eight six zero one two seven'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

76   Pass
%% zstr='148725'; zv=[4 2 ]; vexp='one four eight seven two five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

77   Fail
%% zstr='130'; zv=[2 1 ]; vexp='one three zero'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

78   Fail
%% zstr='59696645'; zv=[1 1 1 2 3 ]; vexp='five nine six nine six six four five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

79   Pass
%% zstr='221065'; zv=[2 2 2 ]; vexp='double two one zero six five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

80   Fail
%% zstr='57715162'; zv=[2 3 2 1 ]; vexp='five seven seven one five one six two'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

81   Fail
%% zstr='110'; zv=[2 1 ]; vexp='double one zero'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

82   Pass
%% zstr='7537367'; zv=[1 4 2 ]; vexp='seven five three seven three six seven'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

83   Fail
%% zstr='9526681205'; zv=[6 3 1 ]; vexp='nine five two double six eight one two zero five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

84   Pass
%% zstr='0818593729'; zv=[1 3 2 4 ]; vexp='zero eight one eight five nine three seven two nine'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

85   Pass
%% zstr='729800081'; zv=[9 ]; vexp='seven two nine eight triple zero eight one'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

86   Fail
%% zstr='2124'; zv=[1 1 1 1 ]; vexp='two one two four'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

87   Fail
%% zstr='7045'; zv=[3 1 ]; vexp='seven zero four five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

88   Pass
%% zstr='6317406'; zv=[7 ]; vexp='six three one seven four zero six'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

89   Fail
%% zstr='922906835'; zv=[8 1 ]; vexp='nine double two nine zero six eight three five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

90   Pass
%% zstr='55'; zv=[2 ]; vexp='double five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

91   Fail
%% zstr='70985826'; zv=[3 2 1 2 ]; vexp='seven zero nine eight five eight two six'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

92   Fail
%% zstr='1619499314'; zv=[8 1 1 ]; vexp='one six one nine four double nine three one four'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

93   Fail
%% zstr='89375'; zv=[1 1 3 ]; vexp='eight nine three seven five'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

94   Pass
%% zstr='655162'; zv=[1 5 ]; vexp='six double five one six two'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

95   Pass
%% zstr='180902'; zv=[3 3 ]; vexp='one eight zero nine zero two'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

96   Pass
%% zstr='39106'; zv=[5 ]; vexp='three nine one zero six'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

97   Pass
%% zstr='82361352'; zv=[6 2 ]; vexp='eight two three six one three five two'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

98   Fail
%% zstr='39'; zv=[1 1 ]; vexp='three nine'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

Error: Assertion failed.

99   Pass
%% zstr='63'; zv=[2 ]; vexp='six three'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp))

100   Pass
%% zstr='16748'; zv=[5 ]; vexp='one six seven four eight'; vstr=Phone_CH(zstr,zv); assert(strcmp(vstr,vexp)) toc

Elapsed time is 0.136711 seconds.

Suggested Problems

More from this Author246

Community Treasure Hunt

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

Start Hunting!