Problem 78. Implement a ROT13 cipher

Created by Cody Team in Community

Replace each character in string s1 with the character that is shifted 13 positions from it (wrap back to the beginning if necessary). So A ? N, B ? O, and so on until Y ? L and Z ? M. Case of the output should match the case of the input, so a ? n. Non-alphabetic characters are left in place and untouched.


 s1 = 'I love MATLAB'


 s2 = 'V ybir ZNGYNO'

See the Wikipedia article for more info.

Solution Stats

55.29% Correct | 44.71% Incorrect
Last solution submitted on Mar 18, 2019

Problem Comments

Solution Comments

Recent Solvers595

Suggested Problems

More from this Author95

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!