6 kyu

Evil Autocorrect Prank

2,084 of 5,257yaphi1

Description:

Your friend won't stop texting his girlfriend. It's all he does. All day. Seriously. The texts are so mushy too! The whole situation just makes you feel ill. Being the wonderful friend that you are, you hatch an evil plot. While he's sleeping, you take his phone and change the autocorrect options so that every time he types "you" or "u" it gets changed to "your sister."

Write a function called autocorrect that takes a string and replaces all instances of "you" or "u" (not case sensitive) with "your sister" (always lower case).

Return the resulting string.

Here's the slightly tricky part: These are text messages, so there are different forms of "you" and "u".

For the purposes of this kata, here's what you need to support:

  • "youuuuu" with any number of u characters tacked onto the end
  • "u" at the beginning, middle, or end of a string, but NOT part of a word
  • "you" but NOT as part of another word like youtube or bayou
Strings
Regular Expressions
Algorithms

Stats:

CreatedJun 1, 2014
PublishedJun 3, 2014
Warriors Trained15164
Total Skips3318
Total Code Submissions73331
Total Times Completed5257
JavaScript Completions2084
Ruby Completions1141
CoffeeScript Completions56
Python Completions1444
Java Completions761
Total Stars302
% of votes with a positive feedback rating88% of 624
Total "Very Satisfied" Votes506
Total "Somewhat Satisfied" Votes91
Total "Not Satisfied" Votes27
Ad
Contributors
  • yaphi1 Avatar
  • jhoffner Avatar
  • daverivera Avatar
  • yihsiaol Avatar
  • PandaWhisperer Avatar
  • Gerrit-K Avatar
  • hobovsky Avatar
Ad