Cody

# Problem 78. Implement a ROT13 cipher

Solution 2161326

Submitted on 16 Mar 2020
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
s1 = 'I love MATLAB'; s2_correct = 'V ybir ZNGYNO'; assert(isequal(rot13(s1),s2_correct))

in = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890;,.!& ' out = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm1234567890;,.!& ' s2 = 'I love MATLAB' s2 = 'V love MATLAB' s2 = 'V love MATLAB' s2 = 'V yove MATLAB' s2 = 'V ybve MATLAB' s2 = 'V ybie MATLAB' s2 = 'V ybir MATLAB' s2 = 'V ybir MATLAB' s2 = 'V ybir ZATLAB' s2 = 'V ybir ZNTLAB' s2 = 'V ybir ZNGLAB' s2 = 'V ybir ZNGYAB' s2 = 'V ybir ZNGYNB' s2 = 'V ybir ZNGYNO' specialcase = 1×0 empty double row vector

2   Fail
s1 = 'I <3 MATLAB!!'; s2_correct = 'V <3 ZNGYNO!!'; assert(isequal(rot13(s1),s2_correct))

in = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890;,.!& ' out = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm1234567890;,.!& ' s2 = 'I <3 MATLAB!!' s2 = 'V <3 MATLAB!!' s2 = 'V <3 MATLAB!!'

Unable to perform assignment because the left and right sides have a different number of elements. Error in rot13 (line 7) s2(i) = out(x) Error in Test2 (line 3) assert(isequal(rot13(s1),s2_correct))

3   Pass
s1 = 'The quick fox stumbled over the confusing instructions.'; s2_correct = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvbaf.'; assert(isequal(rot13(s1),s2_correct))

in = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890;,.!& ' out = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm1234567890;,.!& ' s2 = 'The quick fox stumbled over the confusing instructions.' s2 = 'Ghe quick fox stumbled over the confusing instructions.' s2 = 'Gue quick fox stumbled over the confusing instructions.' s2 = 'Gur quick fox stumbled over the confusing instructions.' s2 = 'Gur quick fox stumbled over the confusing instructions.' s2 = 'Gur duick fox stumbled over the confusing instructions.' s2 = 'Gur dhick fox stumbled over the confusing instructions.' s2 = 'Gur dhvck fox stumbled over the confusing instructions.' s2 = 'Gur dhvpk fox stumbled over the confusing instructions.' s2 = 'Gur dhvpx fox stumbled over the confusing instructions.' s2 = 'Gur dhvpx fox stumbled over the confusing instructions.' s2 = 'Gur dhvpx sox stumbled over the confusing instructions.' s2 = 'Gur dhvpx sbx stumbled over the confusing instructions.' s2 = 'Gur dhvpx sbk stumbled over the confusing instructions.' s2 = 'Gur dhvpx sbk stumbled over the confusing instructions.' s2 = 'Gur dhvpx sbk ftumbled over the confusing instructions.' s2 = 'Gur dhvpx sbk fgumbled over the confusing instructions.' s2 = 'Gur dhvpx sbk fghmbled over the confusing instructions.' s2 = 'Gur dhvpx sbk fghzbled over the confusing instructions.' s2 = 'Gur dhvpx sbk fghzoled over the confusing instructions.' s2 = 'Gur dhvpx sbk fghzoyed over the confusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrd over the confusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq over the confusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq over the confusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bver the confusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bier the confusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq birr the confusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire the confusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire the confusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire ghe confusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gue confusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur confusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur confusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur ponfusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbnfusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbafusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbasusing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashsing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfing instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvng instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvag instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat instructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vnstructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vastructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vaftructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgructions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgeuctions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehctions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehptions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgions.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvons.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvbns.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvbas.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvbaf.' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvbaf.' specialcase = 1×0 empty double row vector

4   Pass
s1 = 'Snape kills Dumbledore on page 606. Also, there is no Santa.'; s2_correct = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnagn.'; assert(isequal(rot13(s1),s2_correct))

in = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890;,.!& ' out = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm1234567890;,.!& ' s2 = 'Snape kills Dumbledore on page 606. Also, there is no Santa.' s2 = 'Fnape kills Dumbledore on page 606. Also, there is no Santa.' s2 = 'Faape kills Dumbledore on page 606. Also, there is no Santa.' s2 = 'Fanpe kills Dumbledore on page 606. Also, there is no Santa.' s2 = 'Fance kills Dumbledore on page 606. Also, there is no Santa.' s2 = 'Fancr kills Dumbledore on page 606. Also, there is no Santa.' s2 = 'Fancr kills Dumbledore on page 606. Also, there is no Santa.' s2 = 'Fancr xills Dumbledore on page 606. Also, there is no Santa.' s2 = 'Fancr xvlls Dumbledore on page 606. Also, there is no Santa.' s2 = 'Fancr xvyls Dumbledore on page 606. Also, there is no Santa.' s2 = 'Fancr xvyys Dumbledore on page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Dumbledore on page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Dumbledore on page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qumbledore on page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhmbledore on page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzbledore on page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoledore on page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyedore on page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrdore on page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqore on page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqbre on page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqbee on page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber on page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber on page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber bn page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba page 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cage 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cnge 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cnte 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Also, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nlso, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyso, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfo, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, there is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, ghere is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, guere is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurre is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, guree is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer is no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vs no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf no Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ao Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Santa.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fanta.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnnta.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnata.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnaga.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnagn.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnagn.' specialcase = 1×0 empty double row vector

### Community Treasure Hunt

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

Start Hunting!