#K49612. Minimal Access Code Transformation
Minimal Access Code Transformation
Minimal Access Code Transformation
You are given a non-empty string s
consisting of only English letters. Your task is to convert the string into a valid access code using minimal changes based on the following rules:
- The first character of the access code must be uppercase.
- For every subsequent character, if its position index i (0-indexed) is even then the character must be uppercase, and if i is odd then it must be lowercase.
For example, given s = "AbcD"
, the output should be "AbCd"
because:
- The character at index 0 is 'A' (already uppercase).
- The character at index 1 is 'b' (lowercase) as required.
- The character at index 2 is 'c' which is transformed to uppercase 'C'.
- The character at index 3 is 'D' which is transformed to lowercase 'd'.
It is guaranteed that the input string contains only English letters.
inputFormat
The input consists of a single line containing the string s
.
Constraints: s
contains only uppercase and lowercase English letters.
outputFormat
Output the transformed access code as a single string.
## sampleAbcD
AbCd