'Why Is My Camel Text Converter not working

I tried making a camel text converter,here are some examples: "the-stealth-warrior" gets converted to "theStealthWarrior", "The_Stealth_Warrior" gets converted to "TheStealthWarrior", Here's my code:

import re
def to_camel_case(text):
    text = str(input("enter the text"))
    text = text.split()
    text.strip("_", "-")
    if re.search("^[a-z]", text[0]):
        text = text[1:].title()
        return (text)
    else:
        text = text.title()
        return (text)

The Error messages I got when I ran tests: Traceback (most recent call last): File "tests.py", line 5, in test.assert_equals(to_camel_case(''), '', "An empty string was provided but not returned") File "/workspace/default/solution.py", line 3, in to_camel_case text = str(input("enter the text")) EOFError: EOF when reading a line



Solution 1:[1]

it says that "An empty string was provided but not returned" so your code must take into consideration when the input is an empty string.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 KamuiYato