33 lines
719 B
Python
33 lines
719 B
Python
'''
|
|
Given an alphabetic string s, return a string where all vowels are removed and a . is inserted before each remaining letter, and make everything lowercase.
|
|
|
|
Vowels are letters A, O, Y, E, U, I, and the rest are consonants.
|
|
|
|
Example 1
|
|
Input:
|
|
hello
|
|
Output:
|
|
.h.l.l
|
|
|
|
Example 2
|
|
Input:
|
|
Codefinity
|
|
Output:
|
|
.c.d.f.n.t
|
|
|
|
'''
|
|
class Solution(object):
|
|
def solve(self, s:str) -> str:
|
|
print(f"s: {s}")
|
|
s_lower = s.lower()
|
|
vowels = ("aeiouy")
|
|
result = ""
|
|
for c in s_lower:
|
|
if c not in vowels:
|
|
result += '.' + c
|
|
return result
|
|
|
|
s = Solution()
|
|
# Example usage
|
|
print(s.solve("HeLlo")) # Output: .h.l.l
|
|
print(s.solve("Codefinity")) # Output: .c.d.f.n.t |