Home > Software design >  Can't figure out how to return input
Can't figure out how to return input

Time:11-02

Basically user has to input their name like jOhn JhOnson and i have to return it as John Jhonson but if the user has 3 names like jonny jon jony I have to return it like Jonny-Jon Jony and i have no idea how

CodePudding user response:

I would use a string tokenizer to count the number of names you have. Then you can easily manipulate each token and then append them altogether for your return value. I can't really help you beyond that without knowing what language you are using.

CodePudding user response:

you can use this code for your purpose

inp = [i.capitalize() for i in input().split()]
print(*inp)
  • Related