Skip to main content
Back to problems
#709
Easy Algorithms

To lower case

String
84.7% acceptance
Feb 21, 2026
2035
2797
Given a string s, return the string after replacing every uppercase letter with the same lowercase letter.

Solution

Rust
Time O(1)
Space O(1)
LeetCode
solution.rs
/*
 * Given a string s, return the string after replacing every uppercase letter with the same lowercase letter.
 * Example 1:
 * Input: s = "Hello"
 * Output: "hello"
 * Example 2:
 * Input: s = "here"
 * Output: "here"
 * Example 3:
 * Input: s = "LOVELY"
 * Output: "lovely"
 * Constraints:
 * 1 <= s.length <= 100
 * s consists of printable ASCII characters.
 */
impl Solution {
  pub fn to_lower_case(s: String) -> String {
    s.to_lowercase()
  }
}