""" 0709.1 - Solution 1 - Built-in lower() """
#####################################################################################
# Classes
#####################################################################################
class Solution:
"""Solution Class"""
def toLowerCase(self, s: str) -> str:
"""To Lower Case Function"""
return s.lower()
#####################################################################################
# Functions
#####################################################################################
def testcase():
"""Test Function"""
print(Solution().toLowerCase("Hello"))
print(Solution().toLowerCase("here"))
print(Solution().toLowerCase("LOVELY"))
#####################################################################################
# Main
#####################################################################################
if __name__ == "__main__":
testcase()
""" 0709.2 - Solution 2 - ASCII Bit Manipulation """
#####################################################################################
# Classes
#####################################################################################
class Solution:
"""Solution Class"""
def toLowerCase(self, s: str) -> str:
"""To Lower Case Function"""
result = []
for c in s:
if 'A' <= c <= 'Z':
result.append(chr(ord(c) | 32))
else:
result.append(c)
return ''.join(result)
#####################################################################################
# Functions
#####################################################################################
def testcase():
"""Test Function"""
print(Solution().toLowerCase("Hello"))
print(Solution().toLowerCase("here"))
print(Solution().toLowerCase("LOVELY"))
#####################################################################################
# Main
#####################################################################################
if __name__ == "__main__":
testcase()