Last Updated: 30 Oct, 2025

Alternating Case Transformation

Easy

Problem statement

You are given a string that may contain a mix of uppercase letters, lowercase letters, digits, and symbols. Your task is to transform this string according to a specific case-alternating rule and print the result.


The transformation rule is as follows:


1) All characters in the output string must appear in the same order as in the input string.

2) The case of the alphabetic characters must alternate, starting with lowercase. The first letter should be lowercase, the second uppercase, the third lowercase, and so on.

3) Non-alphabetic characters (like digits, spaces, and symbols) should not be changed and should be kept in their original positions. These non-alphabetic characters do not affect the alternating case count of the letters.


Input Format:
The first and only line of input contains a single string S.


Output Format:
Print a single line containing the transformed string.


Note:
The core of the problem is to maintain a counter that only increments when you encounter an alphabetic character. This counter will determine whether the current letter should be lowercase (if the count is even) or uppercase (if the count is odd).