Hi, given a string as input, remove any salutations found at the start of the string.
The program which performs the most correct substitutions in under 50 bytes wins.
Hey, a salutation is defined as one of the following words:
The first letter may be capitalised.
There will always be a comma and/or a single space following the salutation which must also be removed. The comma and the space may be in any order (
<space>,) and both should be removed.
The greeting and the following word will only ever be separated by a comma and/or single space.
You must then capitalise the first letter of the word which would have followed the salutation. Even if no replacement has taken place, you should still capitalise the first word of the output.
Capitalisation only applies to lowercase alphabetical characters (
abcdefghijklmnopqrstuvwxyz). You should leave any other character as it was.
The salutation will always be at the start of the string. You should not replace a salutation which is not at the start.
There may not always be a salutation.
Your code must be under 50 bytes.
Input > Output
Salutations, what's going on? > What's going on?
hello i have quetions how does juice an avocado > I have quetions how does juice an avocado
How d'you do > How d'you do
Hey,You! > You!
hola cows eat hay > Cows eat hay
hey Hi there! > Hi there!
hihi ,guys > Guys
Hola, there are 1000 different inputs in total:
The test battery can be found here where each input is separated by a newline: https://github.com/beta-decay/Remove-Substitutions-Battery/blob/master/inputs.txt
The corresponding correct outputs are here: https://github.com/beta-decay/Remove-Substitutions-Battery/blob/master/replaced.txt
A Bash command to retrieve both the above is
Howdy, the program with the most correct substitutions from the 1000 inputs above wins.
You must put the percentage of the inputs your program handles correctly in your header like so:
# Language Name, percentage%
I'm not completely sure why Jeff made this a thing, but it makes a nice challenge nevertheless.