37
3
Write a function/program that accepts a string of lower/uppercase letters [A-Za-z] as input, that checks whether the occuring letters are unique and in alphabetical order (ignoring lower and uppercase) or not. The output must be truthy if they are unique and in alphabetical order and falsy if not.
Here some testcases
a true
abcdefGHIjklmnopqrSTUVWXyz true
aa false
puz true
puzz false
puzZ false
puZ true
PuZ true
pzu false
pzU false
abcdABCD false
dcba false
If you want, run your program on all words of a wordlist like this one and and post some interesting ones =).
Score
Lowest number of bytes wins.
3
Weak test cases. (See my comment on Richard A's PHP answer.)
– manatwork – 2015-03-11T17:20:30.303Does the alphabet loop? Should
za
be a truthy value? – MayorMonty – 2015-09-24T01:06:53.850No, the alphabet begins with
a
and ends withz
. – flawr – 2015-09-24T12:17:20.650You should have some test cases that aren't in alphabetical order – Jo King – 2019-03-03T21:43:41.830
1@JoKing I added some. – flawr – 2019-03-05T09:02:22.710
@manatwork I don't really know PHP, can you suggest some explicit examples? – flawr – 2019-03-05T09:02:56.233
Your freshly added test cases are Ok, they make it obvious that the PHP solution lacks the order check part of the task. – manatwork – 2019-03-05T09:33:40.727
@manatwork Great, thanks for the rapid answer after you had to wait four years for mine:) – flawr – 2019-03-05T09:55:17.330