Alternate Case Converter
Easy
string
case-conversion
alternation
character-processing
Problem Description
Convert a string so that every alternate character is uppercase, starting with the first character as uppercase. Non-alphabetic characters are ignored for the alternation but remain in their positions.
Input Format
A single string containing letters, numbers, and special characters.
Output Format
String with alternating case applied to alphabetic characters only.
Constraints
• 1 ≤ string length ≤ 1000
• Only alphabetic characters change case
• First alphabetic character becomes uppercase
• Non-alphabetic characters don't affect alternation
• Preserve original spacing and punctuation
Sample Input/Output
Input:
coding
Output:
CoDiNg
Explanation
Alternating case: c→C (1st), o→o (2nd), d→D (3rd), i→i (4th), n→N (5th), g→g (6th). Result: "CoDiNg".
Solution Hints
40
Points
Points
1000ms
Time Limit
Time Limit
64MB
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