File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ '''
2
+ Aim: To replace the first character of all the words with their upper case characters.
3
+
4
+ '''
5
+
6
+ # Complete the solve function below.
7
+ def solve (s ):
8
+ # spliiting the string into words
9
+ for x in s [:].split ():
10
+ # replacing the character with it's capital form
11
+ s = s .replace (x , x .capitalize ())
12
+ print ('Updated string:' ,s )
13
+
14
+ # getting the input
15
+ s = input ('Enter string: ' )
16
+ # calling function to compute the result
17
+ solve (s )
18
+
19
+ '''
20
+
21
+ COMPLEXITY:
22
+
23
+ Time Complexity -> O(N)
24
+ Space Complexity -> O(N)
25
+
26
+ Sample Input:
27
+ Enter string: summer of code
28
+
29
+ Sample Output:
30
+ Updated string: Summer Of Code
31
+
32
+ Explanation:
33
+ All the initial characters of the words are capitalized.
34
+
35
+ '''
You can’t perform that action at this time.
0 commit comments