A Caesar cipher shifts every letter forward through the alphabet by a fixed amount, wrapping around from z back to a.
Given a lowercase string s and a whole number n, return the encoded string where each letter is shifted forward by n positions. The shift may be larger than 26, and wrapping must work correctly (shifting z by 1 gives a).
Examples:
s = 'abc', n = 1 -> 'bcd'
s = 'xyz', n = 3 -> 'abc'
s = 'hello', n = 13 -> 'uryyb'
Solution Stats
Solution Comments
Show comments
Loading...
Problem Recent Solvers4
Suggested Problems
-
Caesar Cipher: shift a lowercase string
4 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!