if s[i] is lower and s[i+1] is upper then swap and add * hackerrank code example
Example: swap case hackerrank solution
def swap_case(s):
for i in range (len(s)):
if s[i].isupper():
return s[i].lower()
elif s[i].islower():
return s[i].upper()
else:
return s[i]
s=input()
swap_case(s)
print("".join(map(swap_case,s)))