We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
def camelCasing(word):
if word[0] == 'S': #Split Operation
new_word = word[4:]
result = ''
if word[2] == 'V': #For Variables
for letter in new_word:
if letter.isupper():
result += ' ' + letter.lower()
else:
result += letter
print(result)
elif word[2] == 'M': #For Methods
for letter in new_word:
if letter.isupper():
result += ' ' + letter.lower()
elif letter == '(':
result = result
elif letter == ')':
result = result
else:
result += letter
print(result)
elif word[2] == 'C': #For Classes
new_word = new_word[0].lower() + new_word[1:]
for letter in new_word:
if letter.isupper():
result += ' ' + letter
else:
result += letter
fresult = result.lower()
print(fresult)
if word[0] == 'C': #Combine Operations
n_word = word[4:]
new_word = n_word.split()
result = ''
if word[2] == 'V': #For Variables
result += new_word[0].lower() + ''.join(letter.capitalize() for letter in new_word[1:])
print(result)
if word[2] == 'M': #For Methods
result += new_word[0].lower() + ''.join(letter.capitalize() for letter in new_word[1:])
result +='()'
print(result)
if word[2] == 'C': # For Classes
for letter in new_word:
result = ''.join(letter.capitalize() for letter in new_word)
print(result)
if name == 'main':
import sys
input_lines = sys.stdin.read().strip().split('\n') # Read all input lines
for line in input_lines:
camelCasing(line)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Camel Case 4
You are viewing a single comment's thread. Return to all comments →
def camelCasing(word): if word[0] == 'S': #Split Operation new_word = word[4:] result = ''
if name == 'main': import sys