QUICK

QUICK

YOU HAVE TEN SECONDS TO WRITE A FUNCTION IN YOUR FAVORITE PROGRAMMING LANGUAGE THAT COUNTS THE NUMBER OF WORDS IN A GIVEN STRING WITH TWO OR MORE EQUAL VOWELS

"TOO" => two 'O' => count++
"TO" => one 'O' => doesn't count
"BIRDIE" => two 'I' => count++

OR THIS BIRD IS GOING TO STAB YOU

Attached: 1520888289684.jpg (412x430, 24K)

FUCKING EFFICIENT C MAGIC

#include
#include
#include
#include

int main() {
char* str = "YOU HAVE TEN SECONDS TO WRITE A FUNCTION IN YOUR FAVORITE PROGRAMMING LANGUAGE THAT COUNTS THE NUMBER OF WORDS IN A GIVEN STRING WITH TWO OR MORE EQUAL VOWELS";
int vowels[] = {0, 0, 0, 0, 0};
int count = 0;

for(int n = 0; n = 2) {
count++;
break;
}
}

memset(vowels, 0, sizeof vowels);
}
}

printf("%d\n", count);

return EXIT_SUCCESS;
}

you stupid retard, we aren't going to do your cs homework.

IT'S NOT HOMEWORK YOU FOOL
AND YOU HAVE NO CHOICE

Attached: knife.jpg (4256x2832, 593K)

...

for (int i = 0; i < 100; i++) {
if (i % 3 && i % 5) {
printf("%d\n", i);
continue;
}
if (!(i % 3))
printf("Fizz");
if (!(i % 5))
printf("Buzz");
putchar('\n');
}

BIRDMIN NO

var vStr = "QUICK YOU HAVE TEN SECONDS TO WRITE A FUNCTION IN YOUR FAVORITE PROGRAMMING LANGUAGE THAT COUNTS THE NUMBER OF WORDS IN A GIVEN STRING WITH TWO OR MORE EQUAL VOWELS";

var vArray = vStr.split('').filter(x => {
if (x === ' ') {
return false;
} else {
return true;
}
});

var vVowelCount = 0;
var vVowels = ['a','e','i','o','u'];

vArray.forEach(x => {
if (vVowels.indexOf(x.toLowerCase()) >= 0 ) {
vVowelCount++;
}
});

console.log(vVowelCount);

import re
count = sum(len(re.findall(r'([aoeiu]).*\1', w)) > 0 for w in s.split())
print(count)

good effort
count = len(re.findall('([aeiou])',s, re.I))

>count words with two or more equal vowels
>"good effort"
>yfw

Attached: images.jpg (300x168, 5K)

def g(s):
wordCount = 0
words = []
vowels = "aeiouy"
list_s = s.lower().split()
for el in list_s:
for v in vowels:
if el.count(v) >= 2:
wordCount += 1
words.append(el)
break
return (wordCount, words)

would be silly to have a random chance of counting 'y' as a vowel

He's probably a Turk.

>aeiou are the only vowels
kys angloturd

mr birb,

prepare to be fucked fucked and eaten in gloroius functional javascript on 60.

sincerely,

a nigger.

undef $/;
print 0+(@_==~/\b\S*([aeiou])\S*\1\S*\b/gi);

fuck you french and go réêè somewhere else.

explain

$Sentence = @("too to birdie four chan aaaa") -split ' '
foreach ($Word in $Sentence) {
if ($Word -match '.*([aeiou]).*\1.*') {
$Count++
}
}
Write-Output "Total: $Count out of $($Sentence.Count) words match the criteria."

Are you fucking stupid he is just counting the number of regex matches

if you are seriously unable to do this simple assignment you should just drop out already

GET TO WORK FAGGOTS

Attached: 16531842.jpg (500x695, 47K)

this

val s = "too to birdie four chan aaaa"
val vs = "aeiou".toSet

@ s split ' ' count {_ filter vs groupBy identity exists {_._2.size>=2}}
res1: Int = 3

are you sure you're not counting words like "aaee" twice?

And now with alternative readability:
@ s split ' ' count {_ filter vs groupBy {v=>v} exists {_._2.size>=2}}
res2: Int = 3

nvmd

Ruby.

Attached: Capture.png (581x94, 7K)

>no unicode support
as always, the C code found at Jow Forums is fucking shit

why should you care about the chingdongs using your code

>YOU HAVE TEN SECONDS TO WRITE A FUNCTION IN YOUR FAVORITE PROGRAMMING LANGUAGE
Does bash count? I don't know anything else.

#!/bin/bash

counter=0

echo "Enter a sentence"
read -a sentence

for word in "${sentence[@]}"
do
case "${word,,}" in
*a*a* | *e*e* | *i*i* | *o*o* | *u*u* ) (( counter += 1 ));;
esac
done

echo "$counter word(s) match the criteria!"

>unicode is only needed for asian languages
i hope that's merely ignorance

don't know the language, but this unicorn appears to be counting the number of regex matches. a regex is a like a general pattern for strings. this pattern is defined as
\b\S*([aeiou])\S*\1\S*\b

\b is word boundary, so whenever you see a space next to a character, like " word" or "word ".

\S means any non-space character, the qualifier * means 0 or more. so \S* matches 0 or more non-space characters. it will try to match as many as possible

[aeiou] is a character range, it matches any character in the square brackets.

(...) tells it to remember what's in the parentheses, so it can be reused later.

\1 matches exactly what (...) matched in the specific string earlier. this is what makes sure to find two equal vowels.

so, \b...\b (with only non-space character ranges between them) matches a word, (...)...\1 matches equal vowels, \S* makes sure those vowels can be anywhere within that word.

unicode's only needed for languages that dont matter like nintendo and vodka

You know I usually love Erlang but what the hell is going on.

Attached: cannotmatch.png (608x87, 5K)

or english

lol howdum.ru

Drop the knife

Attached: pleasedontstabmebird.png (1366x768, 90K)

wow
sure you're in the right place, buddy?

>being this ignorant

funny and sad

ANY LAST WISHES?

Attached: chainsaw_crow.jpg (634x523, 128K)

>being this fucktarded
errone knows American only uses ASCII
it's right there in the name
lol dumass

see

see

Stop the flame war and post more algorithms instead. I don't wanna get stabbed.

Readable but ugly. You can make one a function inside that checks for any leader, then map to aeiou. That will give less people cancer

it's completely incorrect in the first place, you retard
kid got stabbed to fuck for that garbage

trolled ;)

dangit you got me

Ok Mr. Birdman

68 chars in JS
s=>s.split(" ").reduce(((n,w)=>/[aeiou].*[aeiou]/i.test(w)?n+1:n),0)

Actually oops that counts words with just two or more vowels

It's actually 3 chars shorter for two of the same vowel
s=>s.split(" ").reduce(((n,w)=>/([aeiou]).*\1/i.test(w)?n+1:n),0)

Though the regex in is certainly even more compact, which takes it down to just 47 chars

s=>s.match(/\b\S*([aeiou])\S*\1\S*\b/ig).length

s=>s.split(" ").reduce((n,w)=>/([aeiou]).*\1/i.test(w)+n,0)

user, try to remember the basics of implicit typecasting.

delicious python with no regex, emphasis on readability


from collections import Counter

def contains_multiple_equal_vowels(word):
cnt = Counter()
for letter in word:
cnt[letter] +=1
counts = [cnt[a] for a in cnt.keys() if a in 'aeiou']
return any(value >= 2 for value in counts)

Attached: Screen Shot 2018-04-22 at 7.37.21 AM.png (992x582, 100K)

>implicit typecasting
I generally consider that a curse word (especially when I mostly write TypeScript these days), though yeah, it does certainly come in handy for golfing purpose. Though you can work around it completely by just using a better regex.

Anata no sukina puroguramingu gengo no kinō de, 2tsu ijō no dōgigo o tsukatte atae rareta mojiretsu no naka ni kazuōku no tango o ireru

def foo(thing):
return len([x for x in thing.split(' ') if any([y for y in x if x.count(y) > 1])])


What now, Birdmin

Attached: 1405532205617.gif (240x240, 119K)

I'm pure VHDL so no thank you :^)

Oh shit, you said vowels, wait

cancerous my friend!

def foo(thing):
return len([x for x in thing.split(' ') if any([y for y in x if ((x.count(y) > 1) and y.lower() in 'aeiou')])])


Fixed

Attached: soyboy01.jpg (720x720, 54K)

Literally why

all the more interesting

what are you, a pussy?

You faggots realize it can be any string i.e. a sentence, not just a single word, right?

I will comment on your corrected function.

1. poorly named- what does foo do? it should be given a name that makes it obvious what it is doing

2. Bird says that the function takes in a word. What is x.split(' ') trying to accomplish?

3. why are you using x and y? again poor naming.

4. A rewrite of your function in a clean way:


def has_multiple_equal_vowels(word):
return any(word.count(letter) > 1 for letter in 'aeiou')

and it ends up being a lot cleaner and more readable even than my previous function ()

It's supposed to take a string of multiple words dumbo

you are right, just re-read the OP ):

>YOU HAVE TEN SECONDS

uve been stabbered friendo

final clean code python version:


def has_multiple_equal_vowels(word):
word = word.lower()
return any(word.count(letter) > 1 for letter in 'aeiou')

def count_words_with_multiple_equal_vowels(text):
words = text.split(' ')
return sum(has_multiple_equal_vowels(word) for word in words)

Set re = New RegExp
With re
.Pattern = "[^\s](a.*a)|(e.*e)|(i.*i)|(o.*o)|(u.*u)[^\s]"
.IgnoreCase = True
.Global = True
End With
WScript.Echo re.Execute(WScript.Arguments.Item(0)).Count

case-insensitive:
val s = "Oto to birdie four chan aaaa"

@
s split ' ' count {_ map {_.toLower} filter vs groupBy {v=>v} exists {_._2.size>=2}}
res1: Int = 3

I dont know how to do the Jow Forums code text thing like OP

Better yet:
@ s.toLowerCase split ' ' count {_ filter vs groupBy {v=>v} exists {_._2.size>=2}}
res2: Int = 3

[ code ] [ / code ] without the spaces

thanks but gave up as if would have been a mess since I wanted to do all the checks concurrently

>tfw 99% of people would have been stabbed already by this fucking bird

I can't tell the complexity of these hacker one line solutions

what I'm thinking:
filter all the consonants, leaving only vowels O(n), operate over new string of size k
sort the vowels O(k logk)
check for consecutive repetitive vowels O(k)

Stabby Bird is usually just to show you can do it, I was focusing on terseness rather than readability. Yours is better if it needs to be used by others though.

>two functions

YOU GET STABBED

Attached: upscale-235773094028212.png (622x600, 649K)

I would rather get stabbed knowing I did something correctly than live and be untrue to myself

Attached: 3735293.jpg (318x409, 23K)

So be it

>extra line for print (why not just wrap that sum in a print)
>not a function

You get stabbed by birb

func(word):
count=0
vowels=[a,i,o,u,e]
for i in word:
for j in vowles:
if i==j:
count+=1

if count >= 2:
print(len(word))

fuck how do i white background thingy

Well the performance of these one liners is always horrible, especially the ones with ToLower() and similar.

benis

"" and "[/code" without comments

Lel shit

[ code ]

[ / code ]

print "hello world!"

sdfdsf

"fddsf"

lmfao

func(word):
count=0
vowels=[a,i,o,u,e]
for i in word:
for j in vowles:
if i==j:
count+=1

if count >= 2:
print(len(word))

thjank

but tolower() is linear and you should only have to do it once at the start of the program.

public class Poo {

public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(pooInLoo("Hola a todos"));
}

public static int pooInLoo(String s){
String[] a=s.split("\\s");
int cont=0;
for(int i=0;i1)
cont++;
}
return cont;
}

}

the power of POO

oh shit it's suppsoed to count words
func(string):
wordcount=0
count=0
vowels=[a,i,o,u,e]
for i in string:
for j in vowles:
if i==j:
count+=1
if i == " ":
if count >=2:
wordcount +=1
count=0

print(wordcount)

func(string):
wordcount=0
count=0
vowels=[a,i,o,u,e]
for i in string:
for j in vowles:
if i==j:
count+=1
if i == " ":
if count >=2:
wordcount +=1
count=0

print(wordcount)
damn

i refuse to give up
func(string):
wordcount=0
count=0
vowels=[a,i,o,u,e]
for i in string:
for j in vowles:
if i==j:
count+=1
if i == " ":
if count >=2:
wordcount +=1
count=0

print(wordcount)

Youre all counting vowels, but not equal vowels.