wes d2a2ba9e15 first commit | 4 år sedan | |
---|---|---|
.. | ||
README.md | 4 år sedan | |
code.cpp | 4 år sedan | |
unitTest.cpp | 4 år sedan |
by Alex Golubov tags: regex, strings
Wurst is the best. Create a function that takes a string and replaces every mention of any type of sausage with the German word "Wurst," unless—of course—the sausage is already a type of German "Wurst" (i.e. "Bratwurst", see below), then leave the sausage name unchanged. German Wursts | Convert to Wurst --- | --- Bratwurst | Kielbasa Kochwurst | Chorizo Leb
Wurst is the best. Create a function that takes a string and replaces every mention of any type of sausage with the German word "Wurst," unless—of course—the sausage is already a type of German "Wurst" (i.e. "Bratwurst", see below), then leave the sausage name unchanged.
German Wursts | Convert to Wurst |
---|---|
Bratwurst | Kielbasa |
Kochwurst | Chorizo |
Leberwurst | Moronga |
Mettwurst | Salami |
Rostbratwurst | Sausage |
~ | Andouille |
~ | Naem |
~ | Merguez |
~ | Gurka |
~ | Snorkers |
~ | Pepperoni |
wurstIsBetter("I like chorizos, but not sausages") ➞ "I like Wursts, but not Wursts"
wurstIsBetter("sich die Wurst vom Brot nehmen lassen") ➞ "sich die Wurst vom Brot nehmen lassen"
wurstIsBetter("Bratwurst and Rostbratwurst are sausages") ➞ "Bratwurst and Rostbratwurst are Wursts"
All German sausage names contain the word "Wurst".