Cody

Problem 78. Implement a ROT13 cipher

Solution 1894162

Submitted on 7 Aug 2019 by Todd Snow
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))

s2 = 'V' s2 = 'V ' s2 = 'V y' s2 = 'V yb' s2 = 'V ybi' s2 = 'V ybir' s2 = 'V ybir ' s2 = 'V ybir Z' s2 = 'V ybir ZN' s2 = 'V ybir ZNG' s2 = 'V ybir ZNGY' s2 = 'V ybir ZNGYN' s2 = 'V ybir ZNGYNO'

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

s2 = 'V' s2 = 'V ' s2 = 'V <' s2 = 'V <3' s2 = 'V <3 ' s2 = 'V <3 Z' s2 = 'V <3 ZN' s2 = 'V <3 ZNG' s2 = 'V <3 ZNGY' s2 = 'V <3 ZNGYN' s2 = 'V <3 ZNGYNO' s2 = 'V <3 ZNGYNO!' s2 = 'V <3 ZNGYNO!!'

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))

s2 = 'G' s2 = 'Gu' s2 = 'Gur' s2 = 'Gur ' s2 = 'Gur d' s2 = 'Gur dh' s2 = 'Gur dhv' s2 = 'Gur dhvp' s2 = 'Gur dhvpx' s2 = 'Gur dhvpx ' s2 = 'Gur dhvpx s' s2 = 'Gur dhvpx sb' s2 = 'Gur dhvpx sbk' s2 = 'Gur dhvpx sbk ' s2 = 'Gur dhvpx sbk f' s2 = 'Gur dhvpx sbk fg' s2 = 'Gur dhvpx sbk fgh' s2 = 'Gur dhvpx sbk fghz' s2 = 'Gur dhvpx sbk fghzo' s2 = 'Gur dhvpx sbk fghzoy' s2 = 'Gur dhvpx sbk fghzoyr' s2 = 'Gur dhvpx sbk fghzoyrq' s2 = 'Gur dhvpx sbk fghzoyrq ' s2 = 'Gur dhvpx sbk fghzoyrq b' s2 = 'Gur dhvpx sbk fghzoyrq bi' s2 = 'Gur dhvpx sbk fghzoyrq bir' s2 = 'Gur dhvpx sbk fghzoyrq bire' s2 = 'Gur dhvpx sbk fghzoyrq bire ' s2 = 'Gur dhvpx sbk fghzoyrq bire g' s2 = 'Gur dhvpx sbk fghzoyrq bire gu' s2 = 'Gur dhvpx sbk fghzoyrq bire gur' s2 = 'Gur dhvpx sbk fghzoyrq bire gur ' s2 = 'Gur dhvpx sbk fghzoyrq bire gur p' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pb' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pba' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbas' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbash' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashf' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfv' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfva' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat ' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat v' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat va' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vaf' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafg' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafge' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgeh' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehp' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpg' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgv' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvb' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvba' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvbaf' s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvbaf.'

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))

s2 = 'F' s2 = 'Fa' s2 = 'Fan' s2 = 'Fanc' s2 = 'Fancr' s2 = 'Fancr ' s2 = 'Fancr x' s2 = 'Fancr xv' s2 = 'Fancr xvy' s2 = 'Fancr xvyy' s2 = 'Fancr xvyyf' s2 = 'Fancr xvyyf ' s2 = 'Fancr xvyyf Q' s2 = 'Fancr xvyyf Qh' s2 = 'Fancr xvyyf Qhz' s2 = 'Fancr xvyyf Qhzo' s2 = 'Fancr xvyyf Qhzoy' s2 = 'Fancr xvyyf Qhzoyr' s2 = 'Fancr xvyyf Qhzoyrq' s2 = 'Fancr xvyyf Qhzoyrqb' s2 = 'Fancr xvyyf Qhzoyrqbe' s2 = 'Fancr xvyyf Qhzoyrqber' s2 = 'Fancr xvyyf Qhzoyrqber ' s2 = 'Fancr xvyyf Qhzoyrqber b' s2 = 'Fancr xvyyf Qhzoyrqber ba' s2 = 'Fancr xvyyf Qhzoyrqber ba ' s2 = 'Fancr xvyyf Qhzoyrqber ba c' s2 = 'Fancr xvyyf Qhzoyrqber ba cn' s2 = 'Fancr xvyyf Qhzoyrqber ba cnt' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr ' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 6' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 60' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606.' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. ' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. N' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Ny' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyf' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb,' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, ' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, g' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gu' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gur' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gure' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer ' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer v' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf a' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab ' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab F' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fn' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fna' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnag' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnagn' s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnagn.'

Suggested Problems

More from this Author95

Community Treasure Hunt

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

Start Hunting!