#include <string>
#include <iostream>
using namespace std;
class Solution {
public:
string toLowerCase(string str)
{
if (str.empty())
{
return str;
}
for (auto it = str.begin(); it!= str.end(); ++it)
{
if (*it >= 'A' && *it <= 'Z')
{
*it = *it - 'A' + 'a';
}
}
return str;
}
};
int main()
{
Solution sol;
cout << sol.toLowerCase("Hello") << endl;
cout << sol.toLowerCase("here") << endl;
cout << sol.toLowerCase("LOVELY") << endl;
}

相关文章:
-
2022-02-15
-
2021-12-03
-
2022-12-23
-
2021-04-08
-
2022-02-02
-
2021-10-07
-
2022-01-01