wes d2a2ba9e15 first commit 4 yıl önce
..
README.md d2a2ba9e15 first commit 4 yıl önce
code.cpp d2a2ba9e15 first commit 4 yıl önce
unitTest.cpp d2a2ba9e15 first commit 4 yıl önce

README.md

Wurst Is Better

by Alex Golubov tags: regex, strings

Summary

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

Instructions

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

Rules

  • Append sausages from the "Convert to Wurst" column with "wurst".
  • Do not replace any German sausage with the word "Wurst".
  • The word "Wurst" must be title case.

Examples

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"

Notes

All German sausage names contain the word "Wurst".