Hello Programmers,

Today I will give you the solution of hackerrank problem which is Caesar Cipher. In this problem, we need to shifts each letter by a number of letters.

Question:

Julius Caesar protected his confidential information by encrypting it using a cipher. Caesar's cipher shifts each letter by a number of letters. If the shift takes you past the end of the alphabet, just rotate back to the front of the alphabet. In the case of a rotation by 3, w, x, y and z would map to z, a, b and c.

For example, the given cleartext

**s= "**

**middle-Outz"**and the alphabet is rotated by

**k=2**. The encrypted string is

**okffng-Qwvb.**

**Example:**

Original alphabet: abcdefghijklmnopqrstuvwxyz Alphabet rotated +3: defghijklmnopqrstuvwxyzabc

Solution:

import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*;

public class Solution {

// Complete the caesar ciphe…