DEV Community

loading...
Cover image for Day 3 Challenge

Day 3 Challenge

hellodevworldblog profile image Hello Dev World Blog Originally published at hellodevworld.com ・1 min read

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

Discussion (0)

pic
Editor guide