Cody

# Problem 751. Implement simple rotation cypher

Solution 2099566

Submitted on 20 Jan 2020 by Nikasha Patel
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
inStr = 'doug'; shift = 10; outStr = 'nyeq'; assert(isequal(cypher(inStr, shift),outStr))

outStr = [] ascii = 100 m = 13 outStr = 'n' ascii = 111 m = 24 outStr = 'ny' ascii = 117 m = 4 outStr = 'nye' ascii = 103 m = 16 outStr = 'nyeq'

2   Pass
inStr = 'thequickbrownfox'; shift = 5; outStr = 'ymjvznhpgwtbsktc'; assert(isequal(cypher(inStr, shift),outStr))

outStr = [] ascii = 116 m = 24 outStr = 'y' ascii = 104 m = 12 outStr = 'ym' ascii = 101 m = 9 outStr = 'ymj' ascii = 113 m = 21 outStr = 'ymjv' ascii = 117 m = 25 outStr = 'ymjvz' ascii = 105 m = 13 outStr = 'ymjvzn' ascii = 99 m = 7 outStr = 'ymjvznh' ascii = 107 m = 15 outStr = 'ymjvznhp' ascii = 98 m = 6 outStr = 'ymjvznhpg' ascii = 114 m = 22 outStr = 'ymjvznhpgw' ascii = 111 m = 19 outStr = 'ymjvznhpgwt' ascii = 119 m = 1 outStr = 'ymjvznhpgwtb' ascii = 110 m = 18 outStr = 'ymjvznhpgwtbs' ascii = 102 m = 10 outStr = 'ymjvznhpgwtbsk' ascii = 111 m = 19 outStr = 'ymjvznhpgwtbskt' ascii = 120 m = 2 outStr = 'ymjvznhpgwtbsktc'

3   Pass
inStr = 'thecrowfliesatmidnight'; shift = 22; outStr = 'pdaynksbheaowpiezjecdp'; assert(isequal(cypher(inStr, shift),outStr))

outStr = [] ascii = 116 m = 15 outStr = 'p' ascii = 104 m = 3 outStr = 'pd' ascii = 101 m = 0 outStr = 'pda' ascii = 99 m = 24 outStr = 'pday' ascii = 114 m = 13 outStr = 'pdayn' ascii = 111 m = 10 outStr = 'pdaynk' ascii = 119 m = 18 outStr = 'pdaynks' ascii = 102 m = 1 outStr = 'pdaynksb' ascii = 108 m = 7 outStr = 'pdaynksbh' ascii = 105 m = 4 outStr = 'pdaynksbhe' ascii = 101 m = 0 outStr = 'pdaynksbhea' ascii = 115 m = 14 outStr = 'pdaynksbheao' ascii = 97 m = 22 outStr = 'pdaynksbheaow' ascii = 116 m = 15 outStr = 'pdaynksbheaowp' ascii = 109 m = 8 outStr = 'pdaynksbheaowpi' ascii = 105 m = 4 outStr = 'pdaynksbheaowpie' ascii = 100 m = 25 outStr = 'pdaynksbheaowpiez' ascii = 110 m = 9 outStr = 'pdaynksbheaowpiezj' ascii = 105 m = 4 outStr = 'pdaynksbheaowpiezje' ascii = 103 m = 2 outStr = 'pdaynksbheaowpiezjec' ascii = 104 m = 3 outStr = 'pdaynksbheaowpiezjecd' ascii = 116 m = 15 outStr = 'pdaynksbheaowpiezjecdp'