Cody

Problem 44088. '5*3' copy character 3 - five times

Solution 1145944

Submitted on 26 Mar 2017 by H M Dipu Kabir
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 = '5*3'; y_correct = '33333'; assert(isequal(repchar(x),y_correct))

x = '33333'

2   Pass
x = '7*a'; y_correct = 'aaaaaaa'; assert(isequal(repchar(x),y_correct))

x = 'aaaaaaa'

3   Pass
x = '1*4'; y_correct = '4'; assert(isequal(repchar(x),y_correct))

x = '4'

4   Pass

5   Pass
x = '[11]*9'; y_correct = '99999999999'; assert(isequal(repchar(x),y_correct))

x = '99999999999'

6   Pass
x = 'abcA;IK4598716[11]*9iobofd89156'; y_correct = 'abcA;IK459871699999999999iobofd89156'; assert(isequal(repchar(x),y_correct))

x = 'abcA;IK459871699999999999iobofd89156'

7   Pass
x = '5*34*7'; y_correct = '333337777'; assert(isequal(repchar(x),y_correct))

x = '333334*7' x = '333337777'

8   Pass
x = '-abc5*3abc4*7abc-'; y_correct = '-abc33333abc7777abc-'; assert(isequal(repchar(x),y_correct))

x = '-abc33333abc4*7abc-' x = '-abc33333abc7777abc-'

9   Pass
x = ']1478151*38791561-3*487945612['; y_correct = ']14781538791561-44487945612['; assert(isequal(repchar(x),y_correct))

x = ']14781538791561-3*487945612[' x = ']14781538791561-44487945612['

10   Pass
x = '5*34*75*5'; y_correct = '33333777755555'; assert(isequal(repchar(x),y_correct))

x = '333334*75*5' x = '3333377775*5' x = '33333777755555'

11   Pass
x = '5*34*7[10]*5'; y_correct = '3333377775555555555'; assert(isequal(repchar(x),y_correct))

x = '333334*7[10]*5' x = '333337777[10]*5' x = '3333377775555555555'

12   Pass
x = '[bdD8-472*3565b1fd4*7rejyyng599811f[10]*5-5116fd1b]'; y_correct = '[bdD8-4733565b1fd7777rejyyng599811f5555555555-5116fd1b]'; assert(isequal(repchar(x),y_correct))

x = '[bdD8-4733565b1fd4*7rejyyng599811f[10]*5-5116fd1b]' x = '[bdD8-4733565b1fd7777rejyyng599811f[10]*5-5116fd1b]' x = '[bdD8-4733565b1fd7777rejyyng599811f5555555555-5116fd1b]'

13   Pass
x = '[]-156fd1s56bf156ds'; y_correct = '[]-156fd1s56bf156ds'; assert(isequal(repchar(x),y_correct))

Community Treasure Hunt

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

Start Hunting!