Skip to content

Commit 9ac9c22

Browse files
committed
docs: kata description
1 parent 89fe7e1 commit 9ac9c22

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# [I before E except after C](https://www.codewars.com/kata/i-before-e-except-after-c "https://www.codewars.com/kata/6834f1a80e0a48c2ea3feeb0")
2+
3+
## Intro
4+
5+
There's a common mnemonic given to those learning English spelling which goes:
6+
7+
> I before E except after C
8+
9+
This suggests that when you have the letters `i` and `e` next to each other in a word, the `i` should come first, with the exception that if preceding the two vowels is the letter `c` in which case the `e` should go first.
10+
11+
For example, this rule would tell you that the word for a close companion would be `"friend"` and not `"freind"`. For the `c` case, this means that when a package is mailed to you, you will `"receive"` it rather than `"recieve"` it.
12+
13+
However, besides being incorrect for many cases (my weird foreign scientist neighbor taught me a few examples), it's not clear from this rule what to do with more unusual cases with multiple `i`s and `e`s.
14+
15+
For the purposes of this kata our rule will be:
16+
17+
> For any contiguous sequence of `i` or `e` characters, all the `i`s should come before all the `e`s. If, however, the sequence is immediately preceeded by a `c`, all the `e`s should come before all the `i`s.
18+
19+
## Task
20+
21+
Write a function which takes in a lowercase word and applies our version of the "I before E except after C" rule.
22+
23+
#### Examples
24+
25+
```
26+
"freind" --> "friend"
27+
"friend" --> "friend"
28+
"recieve" --> "receive"
29+
```
30+
31+
You'll also need to account for the weirder cases that may not exist in real English words.
32+
33+
```
34+
"eeiie" --> "iieee"
35+
"cieee" --> "ceeei"
36+
"eiicieeceie" --> "iieceeiceei"
37+
```

kata/7-kyu/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@
273273
- [How Many Streets?](how-many-streets "66fc9ca2e6d1d0e9cc2e4a4c")
274274
- [How many urinals are free?](how-many-urinals-are-free "5e2733f0e7432a000fb5ecc4")
275275
- [Hungarian Vowel Harmony (easy)](hungarian-vowel-harmony-easy "57fd696e26b06857eb0011e7")
276+
- [I before E except after C](i-before-e-except-after-c "6834f1a80e0a48c2ea3feeb0")
276277
- [I Will Take the Biggest One and Nothing Else](i-will-take-the-biggest-one-and-nothing-else "631082840289bf000e95a334")
277278
- [Incrementer](incrementer "590e03aef55cab099a0002e8")
278279
- [Indexed capitalization](indexed-capitalization "59cfc09a86a6fdf6df0000f1")

0 commit comments

Comments
 (0)