Camel Case is a naming style common in many programming languages. In Java, method and variable names typically start with a lowercase letter, with all subsequent words starting with a capital letter (example: startThread). Names of classes follow the same pattern, except that they start with a capital letter (example: BlueCar).
Your task is to write a program that creates or splits Camel Case variable, method, and class names.
S;M;plasticCup()
C;V;mobile phone
C;C;coffee machine
S;C;LargeSoftwareBook
C;M;white sheet of paper
S;V;pictureFrame
plastic cup
mobilePhone
CoffeeMachine
large software book
whiteSheetOfPaper()
picture frame
Use Scanner to read in all information as if it were coming from the keyboard.
Print all information to the console using standard output (System.out.print() or System.out.println()).
Outputs must be exact (exact spaces and casing).
# Enter your code here. Read input from STDIN. Print output to STDOUT
import sys
lines = sys.stdin.readlines()
lines = [line.rstrip() for line in lines]
for s in lines:
word = s[4:]
tmp = ''
answer = ''
#split
if s[0] == 'S':
if s[2] == 'M':
word = word[:-2]
for i in range(len(word)):
if word[i].isupper():
if tmp:
answer = answer + tmp + " "
tmp = ''
tmp += word[i].lower()
answer += tmp
#combine
else:
lst = word.split()
answer = lst[0]
for i in range(1, len(lst)):
answer += lst[i][0].upper()
answer += lst[i][1:]
if s[2] == 'M':
answer += '()'
if s[2] == 'C':
answer = answer[0].upper() + answer[1:]
print(answer)