Cody

Solution 1779721

Submitted on 9 Apr 2019 by Yingao Zhang
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))

alphabet = 2×26 char array 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' idx = 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = 18 0 0 0 0 0 0 0 0 0 0 0 0 idx = 18 NaN 0 0 0 0 0 0 0 0 0 0 0 idx = 18 NaN 23 0 0 0 0 0 0 0 0 0 0 idx = 18 NaN 23 29 0 0 0 0 0 0 0 0 0 idx = 18 NaN 23 29 43 0 0 0 0 0 0 0 0 idx = 18 NaN 23 29 43 9 0 0 0 0 0 0 0 idx = 18 NaN 23 29 43 9 NaN 0 0 0 0 0 0 idx = 18 NaN 23 29 43 9 NaN 26 0 0 0 0 0 idx = 18 NaN 23 29 43 9 NaN 26 2 0 0 0 0 idx = 18 NaN 23 29 43 9 NaN 26 2 40 0 0 0 idx = 18 NaN 23 29 43 9 NaN 26 2 40 24 0 0 idx = 18 NaN 23 29 43 9 NaN 26 2 40 24 2 0 idx = 18 NaN 23 29 43 9 NaN 26 2 40 24 2 4 alphabet = 2×26 char array 'nopqrstuvwxyzabcdefghijklm' 'NOPQRSTUVWXYZABCDEFGHIJKLM' s2 = 0×0 empty char array 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))

alphabet = 2×26 char array 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' idx = 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = 18 0 0 0 0 0 0 0 0 0 0 0 0 idx = 18 NaN 0 0 0 0 0 0 0 0 0 0 0 idx = 18 NaN NaN 0 0 0 0 0 0 0 0 0 0 idx = 18 NaN NaN NaN 0 0 0 0 0 0 0 0 0 idx = 18 NaN NaN NaN NaN 0 0 0 0 0 0 0 0 idx = 18 NaN NaN NaN NaN 26 0 0 0 0 0 0 0 idx = 18 NaN NaN NaN NaN 26 2 0 0 0 0 0 0 idx = 18 NaN NaN NaN NaN 26 2 40 0 0 0 0 0 idx = 18 NaN NaN NaN NaN 26 2 40 24 0 0 0 0 idx = 18 NaN NaN NaN NaN 26 2 40 24 2 0 0 0 idx = 18 NaN NaN NaN NaN 26 2 40 24 2 4 0 0 idx = 18 NaN NaN NaN NaN 26 2 40 24 2 4 NaN 0 idx = 18 NaN NaN NaN NaN 26 2 40 24 2 4 NaN NaN alphabet = 2×26 char array 'nopqrstuvwxyzabcdefghijklm' 'NOPQRSTUVWXYZABCDEFGHIJKLM' s2 = 0×0 empty char array 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))

alphabet = 2×26 char array 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' idx = Columns 1 through 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 NaN 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 NaN 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 NaN 11 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 NaN 11 29 47 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 NaN 11 29 47 NaN 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 NaN 11 29 47 NaN 37 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 NaN 11 29 47 NaN 37 39 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 NaN 11 29 47 NaN 37 39 41 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 NaN 11 29 47 NaN 37 39 41 25 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 NaN 11 29 47 NaN 37 39 41 25 3 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 NaN 11 29 47 NaN 37 39 41 25 3 23 0 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 NaN 11 29 47 NaN 37 39 41 25 3 23 9 0 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 NaN 11 29 47 NaN 37 39 41 25 3 23 9 7 0 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 NaN 11 29 47 NaN 37 39 41 25 3 23 9 7 NaN 0 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 NaN 11 29 47 NaN 37 39 41 25 3 23 9 7 NaN 29 0 0 0 0 0 0 Columns 31 through 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 40 15 9 NaN 33 41 17 5 21 NaN 11 29 47 NaN 37 3...

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

alphabet = 2×26 char array 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' idx = Columns 1 through 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 17 23 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 17 23 23 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 17 23 23 37 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 17 23 23 37 NaN 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 17 23 23 37 NaN 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 17 23 23 37 NaN 8 41 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 17 23 23 37 NaN 8 41 25 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 17 23 23 37 NaN 8 41 25 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 17 23 23 37 NaN 8 41 25 3 23 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 17 23 23 37 NaN 8 41 25 3 23 9 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 17 23 23 37 NaN 8 41 25 3 23 9 7 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 17 23 23 37 NaN 8 41 25 3 23 9 7 29 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 17 23 23 37 NaN 8 41 25 3 23 9 7 29 35 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 17 23 23 37 NaN 8 41 25 3 23 9 7 29 35 9 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 idx = Columns 1 through 30 38 27 1 31 9 NaN 21 17 23 23 37 NaN 8 41 25 3 23 9 7 29 35 9 NaN 0 0 0 0 0 0 0 Col...