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.
- Camel Case 4
- Discussions
Camel Case 4
Camel Case 4
Sort by
recency
|
495 Discussions
|
Please Login in order to post a comment
Why is it saying that my answer is wrong even though it matches with the expected output?
`
Python 3 code
import sys
strings = [] outputs = []
for line in sys.stdin: line = line.strip() strings.append(line)
def operation(strings): for string in strings: stringSplit = string.split(";") if stringSplit[0] == "S": if stringSplit[1] == "M": outputs.append(camel_case_to_words(stringSplit[2].strip("()"))) elif stringSplit[1] == "C": outputs.append(camel_case_to_words(stringSplit[2])) else: outputs.append(camel_case_to_words(stringSplit[2])) elif stringSplit[0] == "C": string_combine = list_to_camel_case_words((stringSplit[2].split(" "))) if stringSplit[1] == "M": outputs.append(string_combine + "()") elif stringSplit[1] == "C": outputs.append(string_combine[0].upper() + string_combine[1:]) else: outputs.append(string_combine)
def camel_case_to_words(text): result = text[0].lower() for char in text[1:]: if char.isupper(): result += ' ' + char.lower() else: result += char return result
def list_to_camel_case_words(listw: list): output = listw[0] for i in range(1, len(listw)): val = listw[i] output += val[0].upper() + val[1:]
for output in operation(strings): print(output)
Enter your code here. Read input from STDIN. Print output to STDOUT
import sys import re
for line in sys.stdin: line = line.strip() # Get rid of trailing spaces, newlines, etc. operation, object_type, words = line.split(';')
Something is wrong with boilerplate code for typescript, doesn't match with javascript (nodejs) version...
What is wrong with this code, and why didn't it pass the hidden test cases?