Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 204092

Submitted on 14 Feb 2013 by Frank

Correct

60Size
Leading solution size is 11.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
inStr = 'doug';
shift = 10;
outStr = 'nyeq';
assert(isequal(cypher(inStr, shift),outStr))
inStr =
   110   121   101   113
outStr =
nyeq
2
Pass
 
%%
inStr = 'thequickbrownfox';
shift = 5;
outStr = 'ymjvznhpgwtbsktc';
assert(isequal(cypher(inStr, shift),outStr))
inStr =
   121   109   106   118   122   110   104   112   103   119   116    98   115   107   116   125
inStr =
   121   109   106   118   122   110   104   112   103   119   116    98   115   107   116    99
outStr =
ymjvznhpgwtbsktc
3
Pass
 
%%
inStr = 'thecrowfliesatmidnight';
shift = 22;
outStr = 'pdaynksbheaowpiezjecdp';
assert(isequal(cypher(inStr, shift),outStr))
inStr =
  Columns 1 through 16
   112   126   123   121   136   133   141   124   130   127   123   137   119   138   131   127
  Columns 17 through 22
   122   132   127   125   126   138
inStr =
  Columns 1 through 16
   112   100   123   121   136   133   141   124   130   127   123   137   119   138   131   127
  Columns 17 through 22
   122   132   127   125   126   138
inStr =
  Columns 1 through 16
   112   100    97   121   136   133   141   124   130   127   123   137   119   138   131   127
  Columns 17 through 22
   122   132   127   125   126   138
inStr =
  Columns 1 through 16
   112   100    97   121   110   133   141   124   130   127   123   137   119   138   131   127
  Columns 17 through 22
   122   132   127   125   126   138
inStr =
  Columns 1 through 16
   112   100    97   121   110   107   141   124   130   127   123   137   119   138   131   127
  Columns 17 through 22
   122   132   127   125   126   138
inStr =
  Columns 1 through 16
   112   100    97   121   110   107   115   124   130   127   123   137   119   138   131   127
  Columns 17 through 22
   122   132   127   125   126   138
inStr =
  Columns 1 through 16
   112   100    97   121   110   107   115    98   130   127   123   137   119   138   131   127
  Columns 17 through 22
   122   132   127   125   126   138
inStr =
  Columns 1 through 16
   112   100    97   121   110   107   115    98   104   127   123   137   119   138   131   127
  Columns 17 through 22
   122   132   127   125   126   138
inStr =
  Columns 1 through 16
   112   100    97   121   110   107   115    98   104   101   123   137   119   138   131   127
  Columns 17 through 22
   122   132   127   125   126   138
inStr =
  Columns 1 through 16
   112   100    97   121   110   107   115    98   104   101    97   137   119   138   131   127
  Columns 17 through 22
   122   132   127   125   126   138
inStr =
  Columns 1 through 16
   112   100    97   121   110   107   115    98   104   101    97   111   119   138   131   127
  Columns 17 through 22
   122   132   127   125   126   138
inStr =
  Columns 1 through 16
   112   100    97   121   110   107   115    98   104   101    97   111   119   112   131   127
  Columns 17 through 22
   122   132   127   125   126   138
inStr =
  Columns 1 through 16
   112   100    97   121   110   107   115    98   104   101    97   111   119   112   105   127
  Columns 17 through 22
   122   132   127   125   126   138
inStr =
  Columns 1 through 16
   112   100    97   121   110   107   115    98   104   101    97   111   119   112   105   101
  Columns 17 through 22
   122   132   127   125   126   138
inStr =
  Columns 1 through 16
   112   100    97   121   110   107   115    98   104   101    97   111   119   112   105   101
  Columns 17 through 22
   122   106   127   125   126   138
inStr =
  Columns 1 through 16
   112   100    97   121   110   107   115    98   104   101    97   111   119   112   105   101
  Columns 17 through 22
   122   106   101   125   126   138
inStr =
  Columns 1 through 16
   112   100    97   121   110   107   115    98   104   101    97   111   119   112   105   101
  Columns 17 through 22
   122   106   101    99   126   138
inStr =
  Columns 1 through 16
   112   100    97   121   110   107   115    98   104   101    97   111   119   112   105   101
  Columns 17 through 22
   122   106   101    99   100   138
inStr =
  Columns 1 through 16
   112   100    97   121   110   107   115    98   104   101    97   111   119   112   105   101
  Columns 17 through 22
   122   106   101    99   100   112
outStr =
pdaynksbheaowpiezjecdp