|
|
5 years ago | |
|---|---|---|
| .. | ||
| README.md | 5 years ago | |
| code.cpp | 5 years ago | |
| unitTest.cpp | 5 years ago | |
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".