Cody

# Problem 751. Implement simple rotation cypher

Solution 496135

Submitted on 5 Sep 2014 by Peter Lindberg
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))

l = 4 outStr = doug kalle = 110 outStr = noug kalle = 121 outStr = nyug kalle = 127 kalle = 101 outStr = nyeg kalle = 113 outStr = nyeq

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

l = 16 outStr = thequickbrownfox kalle = 121 outStr = yhequickbrownfox kalle = 109 outStr = ymequickbrownfox kalle = 106 outStr = ymjquickbrownfox kalle = 118 outStr = ymjvuickbrownfox kalle = 122 outStr = ymjvzickbrownfox kalle = 110 outStr = ymjvznckbrownfox kalle = 104 outStr = ymjvznhkbrownfox kalle = 112 outStr = ymjvznhpbrownfox kalle = 103 outStr = ymjvznhpgrownfox kalle = 119 outStr = ymjvznhpgwownfox kalle = 116 outStr = ymjvznhpgwtwnfox kalle = 124 kalle = 98 outStr = ymjvznhpgwtbnfox kalle = 115 outStr = ymjvznhpgwtbsfox kalle = 107 outStr = ymjvznhpgwtbskox kalle = 116 outStr = ymjvznhpgwtbsktx kalle = 125 kalle = 99 outStr = ymjvznhpgwtbsktc

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

l = 22 outStr = thecrowfliesatmidnight kalle = 138 kalle = 112 outStr = phecrowfliesatmidnight kalle = 126 kalle = 100 outStr = pdecrowfliesatmidnight kalle = 123 kalle = 97 outStr = pdacrowfliesatmidnight kalle = 121 outStr = pdayrowfliesatmidnight kalle = 136 kalle = 110 outStr = pdaynowfliesatmidnight kalle = 133 kalle = 107 outStr = pdaynkwfliesatmidnight kalle = 141 kalle = 115 outStr = pdaynksfliesatmidnight kalle = 124 kalle = 98 outStr = pdaynksbliesatmidnight kalle = 130 kalle = 104 outStr = pdaynksbhiesatmidnight kalle = 127 kalle = 101 outStr = pdaynksbheesatmidnight kalle = 123 kalle = 97 outStr = pdaynksbheasatmidnight kalle = 137 kalle = 111 outStr = pdaynksbheaoatmidnight kalle = 119 outStr = pdaynksbheaowtmidnight kalle = 138 kalle = 112 outStr = pdaynksbheaowpmidnight kalle = 131 kalle = 105 outStr = pdaynksbheaowpiidnight kalle = 127 kalle = 101 outStr = pdaynksbheaowpiednight kalle = 122 outStr = pdaynksbheaowpieznight kalle = 132 kalle = 106 outStr = pdaynksbheaowpiezjight kalle = 127 kalle = 101 outStr = pdaynksbheaowpiezjeght kalle = 125 kalle = 99 outStr = pdaynksbheaowpiezjecht kalle = 126 kalle = 100 outStr = pdaynksbheaowpiezjecdt kalle = 138 kalle = 112 outStr = pdaynksbheaowpiezjecdp

### Community Treasure Hunt

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

Start Hunting!