8 kyu
Exclamation marks series #11: Replace all vowel to exclamation mark in the sentence
12,709 of 36,240myjinxin2015
Loading description...
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Hello! I am not a native english speaker, but I think 'Y' is a vowel.
I got failed in each test where 'Y' is present, see example below: '!knWPpkgbH' should equal 'YknWPpkgbH'
It looks like some tests include wrong logic.
In many languages, Y is indeed a vowel. In English though, Y is (usually) not a vowel. It is not a kata issue, it is how English works.
Lua translation
Approved
C fork (author gone):
Merged.
"free(): invalid pointer" error in C, if you want me to return solution on heap using *alloc functions, you should say so in the description.
info added
A great python exercise for an essential function.
Hi everyone. I am trying to solve the challenge, Exclamation marks series #11: (Find all vowels in a string and replace them with Exclamation marks) I am using the Kotlin language.
I am not looking for a solution but instead looking for the reason for the error that follows when I submit a simple test.
Here is my code:
fun replace(s: String): String = s
println(s)
return s
I get 4 errors all to do with my println() statement.
src/main/kotlin/solution.kt:2:1: error: expecting a top level declaration println(s) ^ I was just trying to see what was being passed in to s.
Can someone explain to me what I am missing??
Thanks
You should keep your
print
s inside the function scope. Here's an example:Why we need the s. before the replace?
Because that's how methods work in javascript.
I figured that with the 2nd kata, thanks!
пашка
Scala translation
Approved
This comment has been hidden.
This will help you to visualize what your code does: https://pythontutor.com/javascript.html
Thank you man!!!
I cannot thank you enough for the webpage. In just a few days i've been able to understand so much code i didn't before.
python new test framework is required. updated in this fork
Approved
This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/150.
Please join the discussion to help us identify duplicate kata and retire them.
This kata was decided to stay
I get this in Log when submiting.
Testing for:s = "dUU mJauG xcjRgB uPU! MEJtX !Vph SRNkZWc hyyI expected 'D!! MJ!!G XCJRGB !P!! M!JTX !VPH SRNKZWC HYY!' to deeply equal 'd!! mJ!!G xcjRgB !P!! M!JtX !Vph SRNkZWc hyy!' my solution passed the test but I can't submit it. Threre is something wrong with this Kata
Don't use ISSUE tag for these kind of questions, mods will tell you that issue is for issues with the kata not for small problems with your code/solution.
There is nothing wrong with the kata - you need to understand error message: the code that appears after "Expected: bla bla" is what you are returning, and the code after "to Deeply Equal: xyz" is the expected correct answer.
As you can see in the example you have pasted above, your answer is not correct - it's that simple really.
Okey I solved! Take it easy!
.
Description should be language-agnostic
done
This comment has been hidden.
these warnings were cleared at some point
Really good Kata, thanks!
When C++ solution has no header file includes, get error, when attempt to pass full test suite:
Including
<regex>
or<chrono>
header files, allows to run full test suite only with warning:Same issue. I was able to pass test with your help. Thanks!
Fixed.
Hi. For some languages 'y' is also concidered a vovel. I know this isn't the case for English, but it would be great to highlight it in Kata description, or even test examples. It would spare some confusion for foreigners like me.
All characters considered as vowel are currently listed in the description (
y
/Y
are not listed as vowels)just a reminder that "Y" is also a vowel :-D
Depending the language. ;)
Now that's inconsitent... :laughing:
This comment has been hidden.
Read the list of vowels in the instructions.
This comment has been hidden.
You are currently mutating the input string when tests expect you to return a dynamically allocated string
I must ask a question which probably has a very obvious solution. Why must the function be called replace in this kata? It appears to be directly tied to the regular expression method although I cannot see why that should be the case?
Thanks!
There is no particular reason, just because the name of kata is "replace xxxxxx...."
If the question was "why is it mandatory?" the answer is simply that the testing code must know the function's name to test it ^^' If it was "why replace specifically?" then myjinxin answered you, because the function does replace vowel by '!'.
In the C version, free() is not working correctly. On my original solution, before giving up and looking up the solution, I was passing most of the tests however the Random Tests kept failing because of memory allocation. Kata creator should take a look at this. I was using calloc() when declaring dynamic memory for my answer.
It still happens, happened to me, too, exactly as you described. I used malloc(). don't know if it helps you, but maybe another comment would help.
I am facing the same issue too.
This comment has been hidden.
you are mutating the input string and reusing it for the output. you cannot do that, it is a constant string (
const char *
). you need to allocate memory forstr
, and to nul-terminate it as well.Also, you cannot write your own
main()
function on Codewars, the tests already have one.Kotlin translation added!
Approved. Cheers O_o
@myjinxin2015, C/C++ and Java translations available! :-)
All approved. Thanks O_o
Haskell translation kumited! please review :)
Approved. Thanks ;-)
This comment has been hidden.
This Kata reminded me that I had forgotten about regular expressions, I should remember that.
小白一枚 求帮助
所为何事?;-)
zen me le
Lovely little Kata. Just figured out the replace function and stumbled upon this. Nice going!
I like this one! Please write it for C#.
This comment has been hidden.
Just because the input string is "ABCDE". if you don't add option 'i', then your regex only match lowercase letter. So the uppercase letter "A" and "E" will not be matched.
Why dont you add symbols in uppercase?
What do you mean by "Symbols in uppercase"?
This comment has been hidden.
Are you sure it will return
undifend
? In fact, your code always return a character of str, it's not what we want. Some improvement suggestions:And Crystal here ;)
Ruby translation here.
Please review and accept if ok.
PHP Translation Kumited - please accept :D
OK, Approved ;-)
CoffeeScript translation with your random tests kumited! https://www.codewars.com/kumite/58069d5f71aa0201b600015e?sel=580f96174d8fbd42e80013ca Please Accept :D
approved ;-)
Thank you! :D
ISSUE! ISSUE! Duplicate!!! AHHHHHHHHHHHH! Call the police! Call Santa Claus! Call Jake! Call God! Call the Avengers!
No, just kidding!
I like this series! Nice ideas! Very good job! Thanks for this series! I try to do all of them without regex. ;-) My personal challenge. ;-)
@SteffenVogel_79
,Knowingly authoring duplicate katas degrades the overall quality of content on Codewars. It's bizarre that you would cheer these actions on.
Kata descriptions wouldn't need to have a warning saying
"Please don't post issue about difficulty or duplicate."
if they were "novel" and taught "something different".Unfortunately, nobody seems to read (or follow) the Codewars - Kata Best Practices
Make Sure Content is New
Avoid Sequential Titles
It was a joke because he said this in the description. I thought it was clear. ;-)
Generally you are completely right. Thanks for the links. :-)
@zebulan, It's really a joke.
^_^