Cipher Cascade
Easy
string
caesar-cipher
encryption
modular-arithmetic
Problem Description
Encrypt a string using a dynamic Caesar cipher where each character is shifted by its position index (0-based). For example, character at index i is shifted by i positions in the alphabet. Handle wraparound and preserve case.
Input Format
A single string containing only English letters (uppercase and lowercase).
Output Format
The encrypted string with each character shifted by its index position.
Constraints
• 1 ≤ string length ≤ 1000
• String contains only a-z and A-Z
• Preserve original case (upper/lower)
• Use modulo 26 for alphabet wraparound
• Index starts from 0
Sample Input/Output
Input:
abc
Output:
ace
Explanation
Index 0: 'a' + 0 = 'a'. Index 1: 'b' + 1 = 'c'. Index 2: 'c' + 2 = 'e'. Result: "ace".
Solution Hints
65
Points
Points
1500ms
Time Limit
Time Limit
128MB
Memory Limit
Memory Limit
Code Editor
Register to Access Code Editor
Create a free account to solve coding problems and track your progress.
Register Now