report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Caesar cipher - MarisaOJ: Marisa Online Judge

Caesar cipher

Time limit: 1000 ms
Memory limit: 256 MB
The Caesar Cipher is a simple encryption technique that shifts each letter in the plaintext by a fixed number of positions down or up the alphabet. For example, with a shift of $3$: - `a` becomes `d`. - `b` becomes `e`. - `hello` becomes `khoor`. - `zoo` becomes `crr`. Write a program that takes as input a string and a shift value, and performs encryption using the Caesar Cipher. ### Input - The first line contains a string $S$ consisting of lowercase letters and spaces. - The second line contains an integer $k$ $(0 \leq k \leq 25)$, the shift value. ### Output - Print the encrypted string after shifting each letter in $S$ by $k$ positions. ### Constraints - $1 \le |S| \le 1000$. - $0 \le k \le 25$. ### Sample test ``` marisa 3 ``` Output: ``` pdulvd ```
String
Length
Word Count
lowercase
Vowel
Digit sum
Strong password
Letter frequencies
Palindrome string
Palindrome substring
Caesar cipher
String occurences
Sum
String normalization
Run-length encoding
Expression
Topic
Basic
Rating 800
Solution (0) Solution