To Lower Case - Problem
Given a string s, your task is to transform all uppercase letters to lowercase while keeping all other characters unchanged.
This is a fundamental string manipulation problem that tests your understanding of character processing and ASCII values. You need to iterate through each character in the string and convert any uppercase letter (A-Z) to its corresponding lowercase letter (a-z).
Goal: Return a new string with all uppercase letters converted to lowercase.
Example: "Hello World!" becomes "hello world!"
Input & Output
example_1.py โ Basic Mixed Case
$
Input:
s = "Hello"
โบ
Output:
"hello"
๐ก Note:
The uppercase letters 'H' is converted to 'h', while lowercase letters remain unchanged
example_2.py โ Mixed with Numbers and Symbols
$
Input:
s = "Hello123World!"
โบ
Output:
"hello123world!"
๐ก Note:
Only uppercase letters 'H' and 'W' are converted to lowercase. Numbers and special characters remain the same
example_3.py โ Already Lowercase
$
Input:
s = "lovely"
โบ
Output:
"lovely"
๐ก Note:
Since all characters are already lowercase or non-alphabetic, the string remains unchanged
Constraints
- 1 โค s.length โค 100
- s consists only of printable ASCII characters
Visualization
Tap to expand
Understanding the Visualization
1
Read Character
Examine each character in the input string from left to right
2
Check Case
Determine if the character is an uppercase letter (A-Z)
3
Transform
Convert uppercase letters to lowercase, keep all other characters unchanged
4
Build Result
Append the processed character to the result string
Key Takeaway
๐ฏ Key Insight: This problem teaches fundamental string manipulation - processing each character exactly once while applying a simple transformation rule. The beauty lies in its simplicity and the fact that it has a linear time solution.
๐ก
Explanation
AI Ready
๐ก Suggestion
Tab
to accept
Esc
to dismiss
// Output will appear here after running code