6 kyu
Evil Autocorrect Prank
1,449 of 5,266yaphi1
Loading description...
Strings
Regular Expressions
Algorithms
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.
Funny one, "no more hints" on sample tests is actually helpful even if it hurts, as it makes you focus on your code and write exactly what you want rather than just hotfixing until the code passes everything.
Fixed tests below should be added to all languages
you yo ou u yu
ou
yo
u
you
JS: no tests
Duplicate issue below
I must learn regex after seeing the top solutions..
JS:
very practical :V
XD
Coffeescript sample tests contain a typo.
.
No random tests (in Python at least)
None of the languages do. (why spoiler?)
This comment has been hidden.
IDK what's the policy, but almost everywhere it's posted openly, so that they're fixed ASAP. It's your choice tho.
Python version should not use
input
as a variable name, since it is a built-in function.I'm still pretty new to Ruby and coding in general, so sometimes I need help understanding the help docs themselves. I've been able to comprehend a little bit of the Regexp but I'm stuck on how to exlude the puctuations and the if it's a part of another word. Can someone direct me to a specific Regexp that I can look into to help solve?
RegExps are very similar in every language, so you could read about them not specifically in the Ruby docs. I recommend you the MDN Docs
If you need help understanding what your RegExp is doing, use this it will show what exactly your RegExp is doing and will explain every part
Thank you SO much!
For anyone else reading this two years later, I recommend https://regexone.com/, which is the absolute best tutorial on the Internet
This comment has been hidden.
I'm having an issue with two tests failing. Both of them seem to have the correct output but seems to be failing. Here is an example:
input:You should be famous on youville output:your sister should be famous on youville
Any help would be appreciated!
Love this Kata! Fun test cases!
This comment has been hidden.
This comment has been hidden.
can someone break this regular expression down? i'm not exactly sure what the question mark followed by the i character is doing at the beginning? thanks so much!! really appreciated
This comment has been hidden.
"u" at the beginning, middle, or end of a string, but NOT part of a word
what would be an example of this?
convert u to your sister if it's a word, word it's sepreated by spaces
Can you please tell me what the test cases are?... i want to know whats being passed to test if it passes or not. all i get is...what especting something...but got .... something(its vague). i want to test these myself. Thank you very much.
Used this to start teaching myself regex. Nice kata had fun solving it.
This comment has been hidden.
Your answer is valid. I am curious what makes you think otherwise. Also, you should mark any comment containing a solution as spoiler.
'looks like u solved it'
This comment has been hidden.
Overlapping is not possible by default when using
Regex
. So, in the case above, the input isYou u youville utube you youyouyou uuu raiyou united youuuu u you
.The replacement of first (
You
) corresponding to the Regex -->\byou+\b
is done. So now the string becomesyour sister u youville...
. However, the first space character has been checked by Regex object, so upon checking the next group of characters or patterns, it detectsu
only , which does not match the pattern of\bu+\b
, so the output is stillyour sister u youville...
It probably should either include more than ! at the end of input or skip exclamation mark in tests.
This comment has been hidden.
First off you're searching for the word 'your' when you should be searching for 'you' also you also need to ignore case when searching and search for the word 'you' that can contain mutliple trailing 'u', It's very close, you just have to delete 1 character and add 2 to pass all test cases :)
TY TY TY <3<3<3<3<3<3<3<3
This comment has been hidden.
Thank you so much .I appreciate your help
i am quite fresh here and don't know about the rules. so it had said we can import re in python for this kata? so perhaps we can import Queue when dealing with queue?
Yes. Or with any other standard library module you want. Along with some extra packages like numpy too!. Check the list here
That's of great convenience. Thank you for the instruction!
tough for regex beginners, but really helps to learn it :)
This comment has been hidden.
Your code fails for cases like
i <3 u
oruuuuuuu
(with one or multipleu
s trailing at the end)This comment has been hidden.
Are their some cases in which the possible honors received are downgraded?
Nope honors are given based on the kata lvl u attempted :)
Check out this page for more info => (https://github.com/Codewars/codewars.com/wiki/Honor-&-Ranks)
I suggest changing "his girlfriend" to "his EX girlfriend" in the description. That would make it more of an IRL situation :)
Also, instead of 'your sister' could we have something less perverse, like 'myself'?
Such change does not add anything valuable to the core concept of the kata. Also, it is too late and unnecessary to invalidate 5K solutions for the sake of this.
Being abusive to a friend who is happy in a relationship isn't a problem I want to solve. This is a creepy premise, and I'm skipping it.
Nobody said it's a happy relationship. Nobody said this was the moral thing to do. It's just an exercise, get over yourself.
New Kata idea: Where has beechnut's sense of humour gone? See if you can find it.
Software has so much potential to change the world for the better, yet I see so many developers doing things that I would consider ethically questionable. (Or, like the two devs who deigned to comment on my post, doing nothing at all, according to their GitHub pages.)
I think it's important to remind myself that I have a choice in what problems I solve. I'm not saying y'all can't do this exercise if you want to. All I said was that I'm skipping it because I'd never want to expend energy helping a creepy dude sabotage a relationship that he's probably jealous of his friend for having. And if I happen to remind other people that they have a choice in what they work on, cool, but at no point have I tried to tell anyone else what to do, nor will I.
This comment has been hidden.
This kata was funny, I loved solving it :D
This comment has been hidden.
Great kata. Forced me to get familiar with the basics of regex. Regex seems like a whole seperate language with its own shortcuts and caveats. It took me about 2 hours to do a regex 'tutorial' and then about 10 minutes to write and debug a solution. Well done yaphi1
It's a bit ambiguous what you should do with a contraction like "you're". Most of the solutions will replace that with "your sister're".
The following messages may now be removed from the description of the Kata, right?
This comment has been hidden.
This is actually an issue.
http://i.imgur.com/ZM8SoFE.png
Can someone help me out? Looks like the test is bugged.
There is no problem with this kata. I have just submitted my solution without any problem. I can't see your solution but I might contain a bug.
Then why is it rejecting the correct answer?
UPDATE: Just completely rewrote it using a different approach but still getting the same bug, where the returned string is the same as the expected string, but still getting rejected.
Here's the response this time, ignore the console.log(), just testing.
http://i.imgur.com/SvF3QM3.png
UPDATE 2: It appears I was placing an extra space at the beginning of the string, which was casing the rejection message to look bugged. All solved now.
Holy cow, I need to learn me some RegExp. I certainly went overboard on this one. Solid, fun, and teaches a valuable lesson.
I enjoyed the premise of this exercise greatly.
I'm glad to hear it!
Please add tests where "you" occurs multiple times
Added now. Thanks for the suggestion!