DEV Community

Cover image for Day 3 Challenge
Hello Dev World Blog
Hello Dev World Blog

Posted on • Originally published at hellodevworld.com

Day 3 Challenge

Day 3! Today we are going to dive into simple ciphers with a Caesar cipher more specifically ROT13.

The Problem
Create a function that takes a string and returns the string with each letter substituted with the 13th letter after it in the alphabet (ROT13). If there are numbers or special characters included in the string, they should be returned as they are.

Examples:

    rot13("Hello Dev World is awesome")   // Uryyb Qri Jbeyq vf njrfbzr
    rot13("my dogs are the cutest dogs in the world")   // zl qbtf ner gur phgrfg qbtf va gur jbeyq
    rot13("abcdefghijklmnopqrstuvwxyz")  // nopqrstuvwxyzabcdefghijklm
    rot13("#365DaysOfCoding") // #365QnlfBsPbqvat
Enter fullscreen mode Exit fullscreen mode

Top comments (0)