Input Format
A single line of input containing the full name, .
Constraints
- The string consists of alphanumeric characters and spaces.
Note: in a word only the first character is capitalized. Example 12abc when capitalized remains 12abc.
Sample Input
chris alan
Sample Output
Chris Alan
Solution:
import mathimport osimport randomimport reimport sys# Complete the solve function below.def solve(s):g=0s3=""for i in range(len(s)):if(i==g and s[i]!=" "):s3+=s[i].capitalize()elif(s[i]==" "):s3+=s[i]g=i+1else:s3+=s[i]return s3if __name__ == '__main__':fptr = open(os.environ['OUTPUT_PATH'], 'w')s = input()result = solve(s)fptr.write(result + '\n')fptr.close()
0 Comments