Cody

Problem 639. String substitution, sub problem to cryptoMath

This is a sub problem related to this problem:

http://www.mathworks.com/matlabcentral/cody/problems/621-cryptomath-addition

If you have a string

'cab' 

and you have a mapping where you want:

'abc' to map to the digits [906]

then you will get this:

% 'cab' , 'abc', [906] --> [6 9 0];

Another example is:

% 'feed', 'def', [541] --> [1 4 4 5];

Your inputs will be of this form:

out = stringSubstitute(string, letters, digits)
>> stringSubstitute('feed','def',[5 4 1])
ans =
       1     4     4     5

Solution Stats

75.53% Correct | 24.47% Incorrect
Last solution submitted on Oct 31, 2016

Problem Comments

Tags

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more