Cody

# Problem 751. Implement simple rotation cypher

Solution 2022764

Submitted on 15 Nov 2019
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   Fail
inStr = 'doug'; shift = 10; outStr = 'nyeq'; assert(isequal(cypher(inStr, shift),outStr))

bcc = 'abcdefghjklmnopqrstuvwxyz' k = 4 inStr = 'boug' k = 14 inStr = 'bdug' k = 20 inStr = 'bdbg' k = 7 inStr = 'bdba' outStr = 'bdba'

Assertion failed.

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

bcc = 'abcdefghjklmnopqrstuvwxyz' k = 19 inStr = 'hhequickbrownfox' k = 8 inStr = 'hnequickbrownfox' k = 5 inStr = 'hnkquickbrownfox' k = 16 inStr = 'hnkeuickbrownfox' k = 20 inStr = 'hnkejickbrownfox' k = 1×0 empty double row vector

Unable to perform assignment because the left and right sides have a different number of elements. Error in cypher (line 11) inStr(i)=bcc(d) Error in Test2 (line 5) assert(isequal(cypher(inStr, shift),outStr))

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

bcc = 'abcdefghjklmnopqrstuvwxyz' k = 19 inStr = 'thecrowfliesatmidnight' k = 8 inStr = 'thecrowfliesatmidnight' k = 5 inStr = 'thecrowfliesatmidnight' k = 3 inStr = 'thecrowfliesatmidnight' k = 17 inStr = 'thecrowfliesatmidnight' k = 14 inStr = 'thecrowfliesatmidnight' k = 22 inStr = 'thecrowfliesatmidnight' k = 6 inStr = 'thecrowfliesatmidnight' k = 11 inStr = 'thecrowfliesatmidnight' k = 1×0 empty double row vector

Unable to perform assignment because the left and right sides have a different number of elements. Error in cypher (line 11) inStr(i)=bcc(d) Error in Test3 (line 5) assert(isequal(cypher(inStr, shift),outStr))