# Count the number of “e”s in a string without using the letter “e” [closed]

Your code may not contain the letter "e", but must count the number of "e"s in the inputted string and output that as a number. Bonus points if you use a language that is not a codegolf language and a language that actually uses the letter e (unlike brainfuck) --- not a required criteria.

## closed as unclear what you're asking by a spaghetto, NoOneIsHere, Rɪᴋᴇʀ, Sriotchilism O'Zaic, Comrade SparklePonyJun 4 '17 at 23:24

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Case sensitive, I assume? – DJMcMayhem Jun 4 '17 at 21:50
• Up to your discretion – vityavv Jun 4 '17 at 22:03
• Is it okay if output is in unary? – Comrade SparklePony Jun 4 '17 at 23:18
• yes @ComradeSparklePony – vityavv Jun 4 '17 at 23:37
• Edit: New challenge! Don't use the characters "101" Please don't arbitrarily change the rules once answers have been posted. For future challenges I advise you to use the sandbox before posting here – Luis Mendo Jun 4 '17 at 23:56

# Japt, 76 4 bytes

Nope, definitely didn't use e!

è'Ev


Try it online

## Explanation

    :Implicit input of string U
è   :Count.
'E  :"E".
v   :Convert to lowercase.
:Implicit output of result.

• Nice. I had this, èEsG, èdcÄ, and èfcÉ – ETHproductions Jun 5 '17 at 1:21

# MATL, 5 bytes

101=s


Try it online!

# Mathematica, 42 bytes

#~StringCount~StringDrop[ToString[2<1],4]&


input

["dfhjkeehjke"]

output

3

• You can save a byte by using infix notation: ToString[2<1]~StringDrop~4 as the second argument to StringCount. – Greg Martin Jun 4 '17 at 22:56
• or infix StringCount – J42161217 Jun 4 '17 at 23:01

# CJam, 8 bytes

q'd)f=:+


Case sensitive.

Try it online!

### Explanation

q             Read input string
f=        For each character in that string, see if it equals
'd           character "d"
)          increased by 1 (that is, character "e")
:+      Sum the results. Implicitly display


# brainf***, 215 bytes

case sensitive

+[>>>>+++++[-<++>]<[-<++++++++++>]<[-<<->>]<<-[>-<[-]]>+<,]>[>>+>+<<<-]>>>[<<<+>>>-]<<+>[<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]++++++++[<++++++>-]>[<<+>>-]>[<<+>>-]<<]>]<[->>++++++++[<++++++>-]]<[.[-]<]<


155 of the bytes are from printing the number, from here.

Try it online!

# Jelly, 5 bytes

Oċ“d’


Try it online!

### How?

Oċ“d’ - Link: list of characters
O     - cast to ordinals
“d’ - base 250 number 101
ċ    - count occurrences


Alternatives:
O’ċȷ2 - decrement (’) and count occurrences of 100 (ȷ2);
ƓO’ċ³ - evaluate a line from STDIN (Ɠ), decrement (’) and count occurrences of 100 (³)

• It's unfortunate that using an argument instead of STDIN overwrites the ³ == 100 mapping. – DJMcMayhem Jun 4 '17 at 23:35
• I really like how you used base 250 number 101 – vityavv Jun 4 '17 at 23:39
• @DJMcMayhem Yes, that and ⁹==256 do bite the count fairly often (pun-intended), and occasionally ⁸==“”. – Jonathan Allan Jun 4 '17 at 23:41

# APL, 9 bytes

2 bytes saved thanks to @Adam

≢⍞∩22⊃⎕AV


How?

    22⊃⎕AV  ⍝ 'e'
⍞∩         ⍝ intersect with input
≢            ⍝ count

• Save two bytes: ≢⍞∩22⊃⎕AV – Adám Jun 4 '17 at 22:41
• @Adám thanks! can ⊃ always be used for single element indexing? – Uriel Jun 4 '17 at 23:34
• For single elements from a vector, yes. However. – Adám Jun 4 '17 at 23:46

## CJam, 10 bytes

It's annoying that the operation to count the number of instances, e=, contains an e.

q"&dd<":)~


This creates a string &dd< , increments every code point to get 'ee=, and then executes it.

# Python 3, 3026 24 bytes

Extremely basic:

lambda s:s.count('\x65')


4 bytes off thanks to @Challenger's suggestion (adapted to this solution).

51 46 44 bytes, but I like it better:

lambda s:''.join('1'for i in s if i=='\x65')


Output is in unary. I found it first in the hopes that the other way was impossible; for once I'm annoyed that Python lets me do things the easy way.

5 bytes off thanks to @Challenger.

2 bytes off of each thanks to @xnor.

Attribution for the simple method: https://stackoverflow.com/questions/1155617/count-occurrence-of-a-character-in-a-string

Attribution for the unary one: https://stackoverflow.com/questions/1450897/python-removing-characters-except-digits-from-string

• You can golf the second solution: lambda s:''.join('1'for i in s if i==chr(101)) – Esolanging Fruit Jun 4 '17 at 21:59
• @Challenger5 change the input() to s and that'll work – caird coinheringaahing Jun 4 '17 at 22:00
• You can write 'e' as '\x65'. – xnor Jun 4 '17 at 22:03
• if i=='\x65' => if'\x65'==i – Zacharý Jul 13 '17 at 19:47

# Aceto, 21 19 bytes

Ic!_
o=ML
d'I
,dOp


We read a character and duplicate it, then push a "d" and increment its value to have an e. We then store the equality with M. Now we invert the input to get True when we're done, and conditionally jump to the print command at the end. Otherwise, we load our other truth value (whether it was an e), conditionally increment, and jump back to the Origin.

# PHP, 27 Bytes

<?=count_chars(\$argn)[101];


Try it online!

# Scala, 20 bytes

_.count(_=='\u0065')


Try it online!

# 05AB1E, 4 bytes

Ƶ0ç¢


Try it online!

Ƶ0   # Push 101
ç  # Convert to a character
¢ # Count the occurrences of that character


# Retina, 11 bytes

Td-f_f_
f


Try it online! e is indirectly referred to in the translation by creating a range from d to f. The ds and fs are deleted and the es are translated to fs (we can't use d because that would expand to 0-9). It then suffices to count the fs.

• [d-f-[df]] saves one byte. – Cows quack Jun 5 '17 at 3:42
• @KritixiLithos I had no idea you could do that; I think you should go ahead and post that as your own answer. – Neil Jun 5 '17 at 7:52
• Since the challenge is closed, I can't. But I found a large improvement, \x65` for just 4 bytes. – Cows quack Jun 5 '17 at 7:59
• @KritixiLithos Ah of course, use of decimal/hex codes was why the challenge got closed in the first place... – Neil Jun 5 '17 at 8:05