def tolower(x):
    return x.lower()

def toupper(x):
    return x.upper()

s=input()
ans=''
ans+=s[0]
for i in range(1,len(s)):
    if((ord(tolower(s[i-1])) < ord(tolower(s[i]))) and s[i-1]!=" "):
        ans+=toupper(s[i])
    elif((ord(tolower(s[i-1])) > ord(tolower(s[i]))) and s[i-1]!=" "):
        ans+=tolower(s[i])
    elif(s[i]==" " or s[i-1]==" " or (ord(tolower(s[i-1])) == ord(tolower(s[i])))):
        ans+=s[i]
print(ans)        

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: