blob: c5869af02b4d87daebae82727c7811f926be0de2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
-- Perl Weekly Challenge 161
CREATE SCHEMA IF NOT EXISTS pwc161;
WITH words( word, size, sorted, unsorted )
AS (
select word, length( word ),
array( select regexp_split_to_table( word, '' ) order by 1 ) as sorted,
regexp_split_to_array( word, '' ) as unsorted
from pwc161.dictionary )
select word, size
from words
where sorted = unsorted
order by word, size asc;
|