Skip to content

Commit fbfa6b7

Browse files
authored
Merge pull request #747 from Manasi2001/issue-746
Capitalizing
2 parents 4fef60e + 72c4d0e commit fbfa6b7

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Strings/Capitalizing.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
'''

0 commit comments

Comments
 (0)