C# PigLatin exercise : tests failing for Rule 3 and Rule 4
I am writing a Translate function :
Rule 3:If a word starts with zero or more consonants followed by "qu", first move those consonants (if any) and the "qu" part to the end of the word, and then add an "ay" sound to the end of the word.
For example:
"quick" -> "ickqu" -> "ickquay" (starts with "qu", no preceding consonants)
"square" -> "aresqu" -> "aresquay" (starts with one consonant followed by "qu")
Test case failed :
Expected: "eenquay"
Actual: "ueenqay"
Rule 4:If a word starts with one or more consonants followed by "y", first move the consonants preceding the "y"to the end of the word, and then add an "ay" sound to the end of the word.
Some examples:
"my" -> "ym" -> "ymay" (starts with single consonant followed by "y")
"rhythm" -> "ythmrh" -> "ythmrhay" (starts with multiple consonants followed by "y")
Test case failed :
Expected: "ymay"
Actual: "myay"
This is my code
What I am doing wrong?
Rule 3:If a word starts with zero or more consonants followed by "qu", first move those consonants (if any) and the "qu" part to the end of the word, and then add an "ay" sound to the end of the word.
For example:
"quick" -> "ickqu" -> "ickquay" (starts with "qu", no preceding consonants)
"square" -> "aresqu" -> "aresquay" (starts with one consonant followed by "qu")
Test case failed :
Expected: "eenquay"
Actual: "ueenqay"
Rule 4:If a word starts with one or more consonants followed by "y", first move the consonants preceding the "y"to the end of the word, and then add an "ay" sound to the end of the word.
Some examples:
"my" -> "ym" -> "ymay" (starts with single consonant followed by "y")
"rhythm" -> "ythmrh" -> "ythmrhay" (starts with multiple consonants followed by "y")
Test case failed :
Expected: "ymay"
Actual: "myay"
This is my code
What I am doing wrong?
