Cody

# Problem 78. Implement a ROT13 cipher

Solution 1567115

Submitted on 22 Jun 2018 by Prajit T R
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 = 0×0 empty char array s = 73 s2 = 'V' s = 32 s2 = 'V ' s = 108 s2 = 'V y' s = 111 s2 = 'V yb' s = 118 s2 = 'V ybi' s = 101 s2 = 'V ybir' s = 32 s2 = 'V ybir ' s = 77 s2 = 'V ybir Z' s = 65 s2 = 'V ybir ZN' s = 84 s2 = 'V ybir ZNG' s = 76 s2 = 'V ybir ZNGY' s = 65 s2 = 'V ybir ZNGYN' s = 66 s2 = 'V ybir ZNGYNO'

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

s2 = 0×0 empty char array s = 73 s2 = 'V' s = 32 s2 = 'V ' s = 60 s2 = 'V <' s = 51 s2 = 'V <3' s = 32 s2 = 'V <3 ' s = 77 s2 = 'V <3 Z' s = 65 s2 = 'V <3 ZN' s = 84 s2 = 'V <3 ZNG' s = 76 s2 = 'V <3 ZNGY' s = 65 s2 = 'V <3 ZNGYN' s = 66 s2 = 'V <3 ZNGYNO' s = 33 s2 = 'V <3 ZNGYNO!' s = 33 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 = 0×0 empty char array s = 84 s2 = 'G' s = 104 s2 = 'Gu' s = 101 s2 = 'Gur' s = 32 s2 = 'Gur ' s = 113 s2 = 'Gur d' s = 117 s2 = 'Gur dh' s = 105 s2 = 'Gur dhv' s = 99 s2 = 'Gur dhvp' s = 107 s2 = 'Gur dhvpx' s = 32 s2 = 'Gur dhvpx ' s = 102 s2 = 'Gur dhvpx s' s = 111 s2 = 'Gur dhvpx sb' s = 120 s2 = 'Gur dhvpx sbk' s = 32 s2 = 'Gur dhvpx sbk ' s = 115 s2 = 'Gur dhvpx sbk f' s = 116 s2 = 'Gur dhvpx sbk fg' s = 117 s2 = 'Gur dhvpx sbk fgh' s = 109 s2 = 'Gur dhvpx sbk fghz' s = 98 s2 = 'Gur dhvpx sbk fghzo' s = 108 s2 = 'Gur dhvpx sbk fghzoy' s = 101 s2 = 'Gur dhvpx sbk fghzoyr' s = 100 s2 = 'Gur dhvpx sbk fghzoyrq' s = 32 s2 = 'Gur dhvpx sbk fghzoyrq ' s = 111 s2 = 'Gur dhvpx sbk fghzoyrq b' s = 118 s2 = 'Gur dhvpx sbk fghzoyrq bi' s = 101 s2 = 'Gur dhvpx sbk fghzoyrq bir' s = 114 s2 = 'Gur dhvpx sbk fghzoyrq bire' s = 32 s2 = 'Gur dhvpx sbk fghzoyrq bire ' s = 116 s2 = 'Gur dhvpx sbk fghzoyrq bire g' s = 104 s2 = 'Gur dhvpx sbk fghzoyrq bire gu' s = 101 s2 = 'Gur dhvpx sbk fghzoyrq bire gur' s = 32 s2 = 'Gur dhvpx sbk fghzoyrq bire gur ' s = 99 s2 = 'Gur dhvpx sbk fghzoyrq bire gur p' s = 111 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pb' s = 110 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pba' s = 102 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbas' s = 117 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbash' s = 115 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashf' s = 105 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfv' s = 110 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfva' s = 103 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat' s = 32 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat ' s = 105 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat v' s = 110 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat va' s = 115 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vaf' s = 116 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafg' s = 114 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafge' s = 117 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgeh' s = 99 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehp' s = 116 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpg' s = 105 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgv' s = 111 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvb' s = 110 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvba' s = 115 s2 = 'Gur dhvpx sbk fghzoyrq bire gur pbashfvat vafgehpgvbaf' s = 46 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 = 0×0 empty char array s = 83 s2 = 'F' s = 110 s2 = 'Fa' s = 97 s2 = 'Fan' s = 112 s2 = 'Fanc' s = 101 s2 = 'Fancr' s = 32 s2 = 'Fancr ' s = 107 s2 = 'Fancr x' s = 105 s2 = 'Fancr xv' s = 108 s2 = 'Fancr xvy' s = 108 s2 = 'Fancr xvyy' s = 115 s2 = 'Fancr xvyyf' s = 32 s2 = 'Fancr xvyyf ' s = 68 s2 = 'Fancr xvyyf Q' s = 117 s2 = 'Fancr xvyyf Qh' s = 109 s2 = 'Fancr xvyyf Qhz' s = 98 s2 = 'Fancr xvyyf Qhzo' s = 108 s2 = 'Fancr xvyyf Qhzoy' s = 101 s2 = 'Fancr xvyyf Qhzoyr' s = 100 s2 = 'Fancr xvyyf Qhzoyrq' s = 111 s2 = 'Fancr xvyyf Qhzoyrqb' s = 114 s2 = 'Fancr xvyyf Qhzoyrqbe' s = 101 s2 = 'Fancr xvyyf Qhzoyrqber' s = 32 s2 = 'Fancr xvyyf Qhzoyrqber ' s = 111 s2 = 'Fancr xvyyf Qhzoyrqber b' s = 110 s2 = 'Fancr xvyyf Qhzoyrqber ba' s = 32 s2 = 'Fancr xvyyf Qhzoyrqber ba ' s = 112 s2 = 'Fancr xvyyf Qhzoyrqber ba c' s = 97 s2 = 'Fancr xvyyf Qhzoyrqber ba cn' s = 103 s2 = 'Fancr xvyyf Qhzoyrqber ba cnt' s = 101 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr' s = 32 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr ' s = 54 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 6' s = 48 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 60' s = 54 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606' s = 46 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606.' s = 32 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. ' s = 65 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. N' s = 108 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Ny' s = 115 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyf' s = 111 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb' s = 44 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb,' s = 32 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, ' s = 116 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, g' s = 104 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gu' s = 101 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gur' s = 114 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gure' s = 101 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer' s = 32 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer ' s = 105 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer v' s = 115 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf' s = 32 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ' s = 110 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf a' s = 111 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab' s = 32 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab ' s = 83 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab F' s = 97 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fn' s = 110 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fna' s = 116 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnag' s = 97 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnagn' s = 46 s2 = 'Fancr xvyyf Qhzoyrqber ba cntr 606. Nyfb, gurer vf ab Fnagn.'