Capitalize!

  • + 0 comments

    Only thing to mark here is that there are multiple whitespaces in the test cases which needs to be there in our output as well.

    Simple Solution:

    def solve(s):

    l=[]
    
    for i in s:
        l.append(i)
    
    l[0] = l[0].upper()  
    
    for i in range(1,len(l)):
    
        if l[i-1]==" ":
            l[i] = l[i].upper()
    
    ans = "".join(l)
    return ans