--- description: Today 1 leet , tomorrow 頂天leet地 image: https://leetcode.com/static/images/LeetCode_Sharing.png --- # To Lower Case [題目網址<i class="fa fa-link"></i>](https://leetcode.com/problems/to-lower-case/) ## 題目敘述 Given a string `s`, return the string after replacing every uppercase letter with the same lowercase letter. :::spoiler **Example 1** > **Input:** "Hello" > **Output:** "hello" ::: :::spoiler **Example 2** > **Input:** "here" > **Output:** "here" ::: ## 解題思維 將所有**大寫字母**改成小寫 ## 程式碼 ```cpp= class Solution { public: string toLowerCase(string s) { for(int i=0;i<s.size();i++) { if(s[i]>='A'&&s[i]<='Z') { s[i]+=32; } } return s; } }; ``` $O(n)$ ###### tags: `LeetCode` `String`