You are viewing a single comment's thread. Return to all comments →
import os def solve(s): result = '' capitalize_next = True for char in s: if char == ' ': result += char capitalize_next = True elif capitalize_next: result += char.upper() capitalize_next = False else: result += char return result if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') s = input() result = solve(s) # Otherwise import os def solve(s): return s.title() if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') s = input() result = solve(s) fptr.write(result + '\n') fptr.close() fptr.write(result + '\n') fptr.close()
Seems like cookies are disabled on this browser, please enable them to open this website
Capitalize!
You are viewing a single comment's thread. Return to all comments →
For running all test cases this code is required