Given string X, convert it to Java Style string, as defined below:
- Strings may only contain numbers and letters(signs are not allowed)
- Strings must not start with numbers
- Strings must start with Capital letter
- Strings may not contain two capital letters in a raw.
As for conversion you may perform the next actions
- Replace capital letter with lower case letter and vise versa.
- Remove character
A good conversion is defined as follow:
Minimum actions been performed while achieving the next goals:
- all the sequences of capital letters only kept the first letter as capital.
- if a letter has a character in place before it, and the character is not a letter nor a number, then the letter becomes capital.
- in case that after a good conversion there is a contradiction with the style, good conversion will be applied again on the result of previous conversion.
- If there is more then one way to apply good conversion, than conversion
Ais considered to be better then conversion
Ahas more capital letters then
- String x
- Best conversion Java Style String
X Output 'ab<>c' 'AbC' 'a<>b<>c' 'Abc' // conversion been applied twice. ABC -> Abc 'a<>bc' 'Abc' // conversion been applied twice. ABc -> Abc 'HI<>man' 'HiMan' '' '' 'its**cOOL' 'ItsCool' '28and*2fun' 'And2fun' // conversion been applied twice. and2fun -> And2fun
In this example strings been wrapped with '' sign.
- The shortest program wins, as determined by the number of bytes of source code.