Spelling Bee Acceptable
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
This is similar to this question.
However, I have a different goal in mind:
Reduce the wordlist to words that could appear.
The easy part is to delete hyphens and similar.
The hard part, however: Remove words containing more than seven letters.
So, the problem:
Given a set of words containing only lowercase (or uppercase) ASCII letters, remove the words containing eight or more different letters.
Any input and output format is acceptable.
Standard loophole rules apply.
Space to beat: 307 bytes of C compiling without errors or warnings.
Shortest byte count wins, assuming it's less than 307 bytes.
Clever solutions are better, and faster is better as well.
code-golf
add a comment |
up vote
2
down vote
favorite
This is similar to this question.
However, I have a different goal in mind:
Reduce the wordlist to words that could appear.
The easy part is to delete hyphens and similar.
The hard part, however: Remove words containing more than seven letters.
So, the problem:
Given a set of words containing only lowercase (or uppercase) ASCII letters, remove the words containing eight or more different letters.
Any input and output format is acceptable.
Standard loophole rules apply.
Space to beat: 307 bytes of C compiling without errors or warnings.
Shortest byte count wins, assuming it's less than 307 bytes.
Clever solutions are better, and faster is better as well.
code-golf
2
Could you include a test case?
– Dennis♦
7 hours ago
7
It's generally bad practice to have an upper limit on the score. The reason is that some languages are especially verbose or difficult to program in, and the 307 byte requirement would arbitrarily disallow them from competing.
– Nathan Merrill
7 hours ago
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
This is similar to this question.
However, I have a different goal in mind:
Reduce the wordlist to words that could appear.
The easy part is to delete hyphens and similar.
The hard part, however: Remove words containing more than seven letters.
So, the problem:
Given a set of words containing only lowercase (or uppercase) ASCII letters, remove the words containing eight or more different letters.
Any input and output format is acceptable.
Standard loophole rules apply.
Space to beat: 307 bytes of C compiling without errors or warnings.
Shortest byte count wins, assuming it's less than 307 bytes.
Clever solutions are better, and faster is better as well.
code-golf
This is similar to this question.
However, I have a different goal in mind:
Reduce the wordlist to words that could appear.
The easy part is to delete hyphens and similar.
The hard part, however: Remove words containing more than seven letters.
So, the problem:
Given a set of words containing only lowercase (or uppercase) ASCII letters, remove the words containing eight or more different letters.
Any input and output format is acceptable.
Standard loophole rules apply.
Space to beat: 307 bytes of C compiling without errors or warnings.
Shortest byte count wins, assuming it's less than 307 bytes.
Clever solutions are better, and faster is better as well.
code-golf
code-golf
asked 7 hours ago
NoLongerBreathedIn
543
543
2
Could you include a test case?
– Dennis♦
7 hours ago
7
It's generally bad practice to have an upper limit on the score. The reason is that some languages are especially verbose or difficult to program in, and the 307 byte requirement would arbitrarily disallow them from competing.
– Nathan Merrill
7 hours ago
add a comment |
2
Could you include a test case?
– Dennis♦
7 hours ago
7
It's generally bad practice to have an upper limit on the score. The reason is that some languages are especially verbose or difficult to program in, and the 307 byte requirement would arbitrarily disallow them from competing.
– Nathan Merrill
7 hours ago
2
2
Could you include a test case?
– Dennis♦
7 hours ago
Could you include a test case?
– Dennis♦
7 hours ago
7
7
It's generally bad practice to have an upper limit on the score. The reason is that some languages are especially verbose or difficult to program in, and the 307 byte requirement would arbitrarily disallow them from competing.
– Nathan Merrill
7 hours ago
It's generally bad practice to have an upper limit on the score. The reason is that some languages are especially verbose or difficult to program in, and the 307 byte requirement would arbitrarily disallow them from competing.
– Nathan Merrill
7 hours ago
add a comment |
9 Answers
9
active
oldest
votes
up vote
3
down vote
05AB1E, 5 bytes
ʒÙg8‹
Try it online.
Explanation:
ʒ # Filter the (implicit) input-list by:
Ù # Only leave distinct letters of the word
g # Take its length
8‹ # And only leave those with a length smaller than 8
# (And output implicitly after we're done filtering)
add a comment |
up vote
2
down vote
Perl 6, 20 bytes
*.grep(8>*.comb.Set)
Try it online!
Filters by words that have a set of letters with size less than 8.
add a comment |
up vote
2
down vote
Jelly, 6 bytes
Qṫ¥Ðḟ8
Try it online!
How it works
Qṫ¥Ðḟ8 Main link. Argument: A (array or words)
Ðḟ Filterfalse; only keep the words W of A for which the chain to the left
returns a falsy value.
¥ Combine the two links to the left into a dyadic chain.
Q Unique; remove duplicate letters from W.
ṫ 8 Tail 8; remove the first 7 letters of the result.
add a comment |
up vote
2
down vote
APL (Dyalog Unicode), 11 bytes
⍵/⍨8>≢∪⍵¨
Takes input as a list of strings.
⍵/⍨8>≢∪⍵¨
⍵¨ for each word
∪ take unique letters
8>≢ length less than 8 as a boolean (0 or 1)
⍵/⍨ repeat word that many times
Try it online!
add a comment |
up vote
2
down vote
J, 10 bytes
#~9>#@~.@>
explanation
#~ 9 > #@~.@>
#~ NB. filter the input based on...
9 > NB. is 9 greater than...
#@ NB. the length of...
~.@ NB. the unique characters of...
> NB. the unboxed input.
Try it online!
Shouldn't9
be8
?
– Galen Ivanov
1 hour ago
add a comment |
up vote
1
down vote
Python 2, 40 bytes
lambda i:[x for x in i if len(set(x))<8]
Try it online!
Test cases borrowed from @Dennis. Input and output are both lists.
add a comment |
up vote
0
down vote
My solution (implementing a quite clever O(n) algorithm):
#include <stdio.h>
#include <stdint.h>
int main(void)
char str[1024];
while(scanf("%sn", str) == 1)
uint32_t st = 0;
int s = 0;
for(char *p = str; *p && s <= 7; p++)
s += ~st >> (*p - 'a') & 1;
st
if(s <= 7)
printf("%sn", str);
1
You can remove a lot of whitespace from your answer, and make some of your variable names shorter
– Jo King
7 hours ago
Disclaimer: I don't even know what this language is, but I got it down to 169 bytes and I think(?) nothing should be broken... :P
– Quintec
7 hours ago
Since this is code golf, you should mention the byte count (and the language's name) in the header. You should also try to make you code as short as possible. If this is merely intended as a non-competitive reference implementation, is should be part of the question, not a standalone answer.
– Dennis♦
6 hours ago
add a comment |
up vote
0
down vote
Red, 54 bytes
func[b][foreach a b[if 8 > length? unique a[print a]]]
Try it online!
The first test set was taken from Dennis'
add a comment |
up vote
0
down vote
Racket, 95 bytes
(require racket/set)(define(f l)(filter(lambda(x)(<(set-count(list->set(string->list x)))8))l))
Try it online!
The test set was taken from Dennis'
add a comment |
9 Answers
9
active
oldest
votes
9 Answers
9
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
05AB1E, 5 bytes
ʒÙg8‹
Try it online.
Explanation:
ʒ # Filter the (implicit) input-list by:
Ù # Only leave distinct letters of the word
g # Take its length
8‹ # And only leave those with a length smaller than 8
# (And output implicitly after we're done filtering)
add a comment |
up vote
3
down vote
05AB1E, 5 bytes
ʒÙg8‹
Try it online.
Explanation:
ʒ # Filter the (implicit) input-list by:
Ù # Only leave distinct letters of the word
g # Take its length
8‹ # And only leave those with a length smaller than 8
# (And output implicitly after we're done filtering)
add a comment |
up vote
3
down vote
up vote
3
down vote
05AB1E, 5 bytes
ʒÙg8‹
Try it online.
Explanation:
ʒ # Filter the (implicit) input-list by:
Ù # Only leave distinct letters of the word
g # Take its length
8‹ # And only leave those with a length smaller than 8
# (And output implicitly after we're done filtering)
05AB1E, 5 bytes
ʒÙg8‹
Try it online.
Explanation:
ʒ # Filter the (implicit) input-list by:
Ù # Only leave distinct letters of the word
g # Take its length
8‹ # And only leave those with a length smaller than 8
# (And output implicitly after we're done filtering)
answered 1 hour ago


Kevin Cruijssen
33.1k554176
33.1k554176
add a comment |
add a comment |
up vote
2
down vote
Perl 6, 20 bytes
*.grep(8>*.comb.Set)
Try it online!
Filters by words that have a set of letters with size less than 8.
add a comment |
up vote
2
down vote
Perl 6, 20 bytes
*.grep(8>*.comb.Set)
Try it online!
Filters by words that have a set of letters with size less than 8.
add a comment |
up vote
2
down vote
up vote
2
down vote
Perl 6, 20 bytes
*.grep(8>*.comb.Set)
Try it online!
Filters by words that have a set of letters with size less than 8.
Perl 6, 20 bytes
*.grep(8>*.comb.Set)
Try it online!
Filters by words that have a set of letters with size less than 8.
answered 7 hours ago
Jo King
18.6k241101
18.6k241101
add a comment |
add a comment |
up vote
2
down vote
Jelly, 6 bytes
Qṫ¥Ðḟ8
Try it online!
How it works
Qṫ¥Ðḟ8 Main link. Argument: A (array or words)
Ðḟ Filterfalse; only keep the words W of A for which the chain to the left
returns a falsy value.
¥ Combine the two links to the left into a dyadic chain.
Q Unique; remove duplicate letters from W.
ṫ 8 Tail 8; remove the first 7 letters of the result.
add a comment |
up vote
2
down vote
Jelly, 6 bytes
Qṫ¥Ðḟ8
Try it online!
How it works
Qṫ¥Ðḟ8 Main link. Argument: A (array or words)
Ðḟ Filterfalse; only keep the words W of A for which the chain to the left
returns a falsy value.
¥ Combine the two links to the left into a dyadic chain.
Q Unique; remove duplicate letters from W.
ṫ 8 Tail 8; remove the first 7 letters of the result.
add a comment |
up vote
2
down vote
up vote
2
down vote
Jelly, 6 bytes
Qṫ¥Ðḟ8
Try it online!
How it works
Qṫ¥Ðḟ8 Main link. Argument: A (array or words)
Ðḟ Filterfalse; only keep the words W of A for which the chain to the left
returns a falsy value.
¥ Combine the two links to the left into a dyadic chain.
Q Unique; remove duplicate letters from W.
ṫ 8 Tail 8; remove the first 7 letters of the result.
Jelly, 6 bytes
Qṫ¥Ðḟ8
Try it online!
How it works
Qṫ¥Ðḟ8 Main link. Argument: A (array or words)
Ðḟ Filterfalse; only keep the words W of A for which the chain to the left
returns a falsy value.
¥ Combine the two links to the left into a dyadic chain.
Q Unique; remove duplicate letters from W.
ṫ 8 Tail 8; remove the first 7 letters of the result.
answered 7 hours ago


Dennis♦
183k32293727
183k32293727
add a comment |
add a comment |
up vote
2
down vote
APL (Dyalog Unicode), 11 bytes
⍵/⍨8>≢∪⍵¨
Takes input as a list of strings.
⍵/⍨8>≢∪⍵¨
⍵¨ for each word
∪ take unique letters
8>≢ length less than 8 as a boolean (0 or 1)
⍵/⍨ repeat word that many times
Try it online!
add a comment |
up vote
2
down vote
APL (Dyalog Unicode), 11 bytes
⍵/⍨8>≢∪⍵¨
Takes input as a list of strings.
⍵/⍨8>≢∪⍵¨
⍵¨ for each word
∪ take unique letters
8>≢ length less than 8 as a boolean (0 or 1)
⍵/⍨ repeat word that many times
Try it online!
add a comment |
up vote
2
down vote
up vote
2
down vote
APL (Dyalog Unicode), 11 bytes
⍵/⍨8>≢∪⍵¨
Takes input as a list of strings.
⍵/⍨8>≢∪⍵¨
⍵¨ for each word
∪ take unique letters
8>≢ length less than 8 as a boolean (0 or 1)
⍵/⍨ repeat word that many times
Try it online!
APL (Dyalog Unicode), 11 bytes
⍵/⍨8>≢∪⍵¨
Takes input as a list of strings.
⍵/⍨8>≢∪⍵¨
⍵¨ for each word
∪ take unique letters
8>≢ length less than 8 as a boolean (0 or 1)
⍵/⍨ repeat word that many times
Try it online!
answered 6 hours ago


Quintec
1,115517
1,115517
add a comment |
add a comment |
up vote
2
down vote
J, 10 bytes
#~9>#@~.@>
explanation
#~ 9 > #@~.@>
#~ NB. filter the input based on...
9 > NB. is 9 greater than...
#@ NB. the length of...
~.@ NB. the unique characters of...
> NB. the unboxed input.
Try it online!
Shouldn't9
be8
?
– Galen Ivanov
1 hour ago
add a comment |
up vote
2
down vote
J, 10 bytes
#~9>#@~.@>
explanation
#~ 9 > #@~.@>
#~ NB. filter the input based on...
9 > NB. is 9 greater than...
#@ NB. the length of...
~.@ NB. the unique characters of...
> NB. the unboxed input.
Try it online!
Shouldn't9
be8
?
– Galen Ivanov
1 hour ago
add a comment |
up vote
2
down vote
up vote
2
down vote
J, 10 bytes
#~9>#@~.@>
explanation
#~ 9 > #@~.@>
#~ NB. filter the input based on...
9 > NB. is 9 greater than...
#@ NB. the length of...
~.@ NB. the unique characters of...
> NB. the unboxed input.
Try it online!
J, 10 bytes
#~9>#@~.@>
explanation
#~ 9 > #@~.@>
#~ NB. filter the input based on...
9 > NB. is 9 greater than...
#@ NB. the length of...
~.@ NB. the unique characters of...
> NB. the unboxed input.
Try it online!
answered 5 hours ago


Jonah
1,772816
1,772816
Shouldn't9
be8
?
– Galen Ivanov
1 hour ago
add a comment |
Shouldn't9
be8
?
– Galen Ivanov
1 hour ago
Shouldn't
9
be 8
?– Galen Ivanov
1 hour ago
Shouldn't
9
be 8
?– Galen Ivanov
1 hour ago
add a comment |
up vote
1
down vote
Python 2, 40 bytes
lambda i:[x for x in i if len(set(x))<8]
Try it online!
Test cases borrowed from @Dennis. Input and output are both lists.
add a comment |
up vote
1
down vote
Python 2, 40 bytes
lambda i:[x for x in i if len(set(x))<8]
Try it online!
Test cases borrowed from @Dennis. Input and output are both lists.
add a comment |
up vote
1
down vote
up vote
1
down vote
Python 2, 40 bytes
lambda i:[x for x in i if len(set(x))<8]
Try it online!
Test cases borrowed from @Dennis. Input and output are both lists.
Python 2, 40 bytes
lambda i:[x for x in i if len(set(x))<8]
Try it online!
Test cases borrowed from @Dennis. Input and output are both lists.
answered 2 hours ago
ElPedro
3,3931023
3,3931023
add a comment |
add a comment |
up vote
0
down vote
My solution (implementing a quite clever O(n) algorithm):
#include <stdio.h>
#include <stdint.h>
int main(void)
char str[1024];
while(scanf("%sn", str) == 1)
uint32_t st = 0;
int s = 0;
for(char *p = str; *p && s <= 7; p++)
s += ~st >> (*p - 'a') & 1;
st
if(s <= 7)
printf("%sn", str);
1
You can remove a lot of whitespace from your answer, and make some of your variable names shorter
– Jo King
7 hours ago
Disclaimer: I don't even know what this language is, but I got it down to 169 bytes and I think(?) nothing should be broken... :P
– Quintec
7 hours ago
Since this is code golf, you should mention the byte count (and the language's name) in the header. You should also try to make you code as short as possible. If this is merely intended as a non-competitive reference implementation, is should be part of the question, not a standalone answer.
– Dennis♦
6 hours ago
add a comment |
up vote
0
down vote
My solution (implementing a quite clever O(n) algorithm):
#include <stdio.h>
#include <stdint.h>
int main(void)
char str[1024];
while(scanf("%sn", str) == 1)
uint32_t st = 0;
int s = 0;
for(char *p = str; *p && s <= 7; p++)
s += ~st >> (*p - 'a') & 1;
st
if(s <= 7)
printf("%sn", str);
1
You can remove a lot of whitespace from your answer, and make some of your variable names shorter
– Jo King
7 hours ago
Disclaimer: I don't even know what this language is, but I got it down to 169 bytes and I think(?) nothing should be broken... :P
– Quintec
7 hours ago
Since this is code golf, you should mention the byte count (and the language's name) in the header. You should also try to make you code as short as possible. If this is merely intended as a non-competitive reference implementation, is should be part of the question, not a standalone answer.
– Dennis♦
6 hours ago
add a comment |
up vote
0
down vote
up vote
0
down vote
My solution (implementing a quite clever O(n) algorithm):
#include <stdio.h>
#include <stdint.h>
int main(void)
char str[1024];
while(scanf("%sn", str) == 1)
uint32_t st = 0;
int s = 0;
for(char *p = str; *p && s <= 7; p++)
s += ~st >> (*p - 'a') & 1;
st
if(s <= 7)
printf("%sn", str);
My solution (implementing a quite clever O(n) algorithm):
#include <stdio.h>
#include <stdint.h>
int main(void)
char str[1024];
while(scanf("%sn", str) == 1)
uint32_t st = 0;
int s = 0;
for(char *p = str; *p && s <= 7; p++)
s += ~st >> (*p - 'a') & 1;
st
if(s <= 7)
printf("%sn", str);
answered 7 hours ago
NoLongerBreathedIn
543
543
1
You can remove a lot of whitespace from your answer, and make some of your variable names shorter
– Jo King
7 hours ago
Disclaimer: I don't even know what this language is, but I got it down to 169 bytes and I think(?) nothing should be broken... :P
– Quintec
7 hours ago
Since this is code golf, you should mention the byte count (and the language's name) in the header. You should also try to make you code as short as possible. If this is merely intended as a non-competitive reference implementation, is should be part of the question, not a standalone answer.
– Dennis♦
6 hours ago
add a comment |
1
You can remove a lot of whitespace from your answer, and make some of your variable names shorter
– Jo King
7 hours ago
Disclaimer: I don't even know what this language is, but I got it down to 169 bytes and I think(?) nothing should be broken... :P
– Quintec
7 hours ago
Since this is code golf, you should mention the byte count (and the language's name) in the header. You should also try to make you code as short as possible. If this is merely intended as a non-competitive reference implementation, is should be part of the question, not a standalone answer.
– Dennis♦
6 hours ago
1
1
You can remove a lot of whitespace from your answer, and make some of your variable names shorter
– Jo King
7 hours ago
You can remove a lot of whitespace from your answer, and make some of your variable names shorter
– Jo King
7 hours ago
Disclaimer: I don't even know what this language is, but I got it down to 169 bytes and I think(?) nothing should be broken... :P
– Quintec
7 hours ago
Disclaimer: I don't even know what this language is, but I got it down to 169 bytes and I think(?) nothing should be broken... :P
– Quintec
7 hours ago
Since this is code golf, you should mention the byte count (and the language's name) in the header. You should also try to make you code as short as possible. If this is merely intended as a non-competitive reference implementation, is should be part of the question, not a standalone answer.
– Dennis♦
6 hours ago
Since this is code golf, you should mention the byte count (and the language's name) in the header. You should also try to make you code as short as possible. If this is merely intended as a non-competitive reference implementation, is should be part of the question, not a standalone answer.
– Dennis♦
6 hours ago
add a comment |
up vote
0
down vote
Red, 54 bytes
func[b][foreach a b[if 8 > length? unique a[print a]]]
Try it online!
The first test set was taken from Dennis'
add a comment |
up vote
0
down vote
Red, 54 bytes
func[b][foreach a b[if 8 > length? unique a[print a]]]
Try it online!
The first test set was taken from Dennis'
add a comment |
up vote
0
down vote
up vote
0
down vote
Red, 54 bytes
func[b][foreach a b[if 8 > length? unique a[print a]]]
Try it online!
The first test set was taken from Dennis'
Red, 54 bytes
func[b][foreach a b[if 8 > length? unique a[print a]]]
Try it online!
The first test set was taken from Dennis'
answered 1 hour ago
Galen Ivanov
5,54211031
5,54211031
add a comment |
add a comment |
up vote
0
down vote
Racket, 95 bytes
(require racket/set)(define(f l)(filter(lambda(x)(<(set-count(list->set(string->list x)))8))l))
Try it online!
The test set was taken from Dennis'
add a comment |
up vote
0
down vote
Racket, 95 bytes
(require racket/set)(define(f l)(filter(lambda(x)(<(set-count(list->set(string->list x)))8))l))
Try it online!
The test set was taken from Dennis'
add a comment |
up vote
0
down vote
up vote
0
down vote
Racket, 95 bytes
(require racket/set)(define(f l)(filter(lambda(x)(<(set-count(list->set(string->list x)))8))l))
Try it online!
The test set was taken from Dennis'
Racket, 95 bytes
(require racket/set)(define(f l)(filter(lambda(x)(<(set-count(list->set(string->list x)))8))l))
Try it online!
The test set was taken from Dennis'
answered 37 mins ago
Galen Ivanov
5,54211031
5,54211031
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f175559%2fspelling-bee-acceptable%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
2
Could you include a test case?
– Dennis♦
7 hours ago
7
It's generally bad practice to have an upper limit on the score. The reason is that some languages are especially verbose or difficult to program in, and the 307 byte requirement would arbitrarily disallow them from competing.
– Nathan Merrill
7 hours ago