Skip to main content
shaved off 3 bytes by using rejoin
Source Link
draegtun
  • 1.7k
  • 10
  • 12

Rebol, 149149, 146 bytes

f: func[s][l: charset[#"a"- #"z"#"A"- #"Z"]to-string#"Z"]rejoin sort/skip collect[parse sort s[any[copy t[copy o l any o](keep length? t keep last t)| skip]]]2]

Try it online!

Ungolfed:

f: func [s] [
    l: charset[#"a" - #"z" #"A" - #"Z"]
    to-stringrejoin sort/skip collect [
        parse sort s [
            any [
                copy t [copy o l any o] (keep length? t keep last t)
                | skip
            ] 
        ]
    ] 2
]

Example usage in Rebol console:

>> f "Kitkat Tango"
== "1g1i1n1o2a2k3T"

>> f "Database Partitions Task"
== "1b1D1e1k1n1o1P1r2i3s4T5a"

>> f "12$*34^!"
== ""

Rebol, 149 bytes

f: func[s][l: charset[#"a"- #"z"#"A"- #"Z"]to-string sort/skip collect[parse sort s[any[copy t[copy o l any o](keep length? t keep last t)| skip]]]2]

Try it online!

Ungolfed:

f: func [s] [
    l: charset[#"a" - #"z" #"A" - #"Z"]
    to-string sort/skip collect [
        parse sort s [
            any [
                copy t [copy o l any o] (keep length? t keep last t)
                | skip
            ] 
        ]
    ] 2
]

Example usage in Rebol console:

>> f "Kitkat Tango"
== "1g1i1n1o2a2k3T"

>> f "Database Partitions Task"
== "1b1D1e1k1n1o1P1r2i3s4T5a"

>> f "12$*34^!"
== ""

Rebol, 149, 146 bytes

f: func[s][l: charset[#"a"- #"z"#"A"- #"Z"]rejoin sort/skip collect[parse sort s[any[copy t[copy o l any o](keep length? t keep last t)| skip]]]2]

Try it online!

Ungolfed:

f: func [s] [
    l: charset[#"a" - #"z" #"A" - #"Z"]
    rejoin sort/skip collect [
        parse sort s [
            any [
                copy t [copy o l any o] (keep length? t keep last t)
                | skip
            ] 
        ]
    ] 2
]

Example usage in Rebol console:

>> f "Kitkat Tango"
== "1g1i1n1o2a2k3T"

>> f "Database Partitions Task"
== "1b1D1e1k1n1o1P1r2i3s4T5a"

>> f "12$*34^!"
== ""
added "Try it online!" link
Source Link
draegtun
  • 1.7k
  • 10
  • 12

Rebol, 149 bytes

f: func[s][l: charset[#"a"- #"z"#"A"- #"Z"]to-string sort/skip collect[parse sort s[any[copy t[copy o l any o](keep length? t keep last t)| skip]]]2]

Try it online!

Ungolfed:

f: func [s] [
    l: charset[#"a" - #"z" #"A" - #"Z"]
    to-string sort/skip collect [
        parse sort s [
            any [
                copy t [copy o l any o] (keep length? t keep last t)
                | skip
            ] 
        ]
    ] 2
]

Example usage in Rebol console:

>> f "Kitkat Tango"
== "1g1i1n1o2a2k3T"

>> f "Database Partitions Task"
== "1b1D1e1k1n1o1P1r2i3s4T5a"

>> f "12$*34^!"
== ""

Rebol, 149 bytes

f: func[s][l: charset[#"a"- #"z"#"A"- #"Z"]to-string sort/skip collect[parse sort s[any[copy t[copy o l any o](keep length? t keep last t)| skip]]]2]

Ungolfed:

f: func [s] [
    l: charset[#"a" - #"z" #"A" - #"Z"]
    to-string sort/skip collect [
        parse sort s [
            any [
                copy t [copy o l any o] (keep length? t keep last t)
                | skip
            ] 
        ]
    ] 2
]

Example usage in Rebol console:

>> f "Kitkat Tango"
== "1g1i1n1o2a2k3T"

>> f "Database Partitions Task"
== "1b1D1e1k1n1o1P1r2i3s4T5a"

>> f "12$*34^!"
== ""

Rebol, 149 bytes

f: func[s][l: charset[#"a"- #"z"#"A"- #"Z"]to-string sort/skip collect[parse sort s[any[copy t[copy o l any o](keep length? t keep last t)| skip]]]2]

Try it online!

Ungolfed:

f: func [s] [
    l: charset[#"a" - #"z" #"A" - #"Z"]
    to-string sort/skip collect [
        parse sort s [
            any [
                copy t [copy o l any o] (keep length? t keep last t)
                | skip
            ] 
        ]
    ] 2
]

Example usage in Rebol console:

>> f "Kitkat Tango"
== "1g1i1n1o2a2k3T"

>> f "Database Partitions Task"
== "1b1D1e1k1n1o1P1r2i3s4T5a"

>> f "12$*34^!"
== ""
quick fix & tidy up
Source Link
draegtun
  • 1.7k
  • 10
  • 12

Rebol, 144149 bytes

f: func[s][l: charset[#"a"- #"z"]to#"z"#"A"- #"Z"]to-string sort/skip collect[parse sort lowercase s[any[copy t[copy o l any o](keep length? t keep olast t)| skip]]]2]

Ungolfed:

f: func [s] [
    l: charset[#"a" - #"z"]#"z" #"A" - #"Z"]
    to-string sort/skip collect [
        parse sort lowercase s [
            any [
                copy t [copy o l any o] (keep length? t keep olast t)
                | skip
            ] 
        ]
    ] 2
]

Example usage in Rebol console:

>> f "Kitkat Tango!!"Tango"
== "1g1i1n1o2a2k3t""1g1i1n1o2a2k3T"

>> f "Database Partitions Task"
== "1b1d1e1k1n1o1p1r2i3s4t5a""1b1D1e1k1n1o1P1r2i3s4T5a"

>> f "12$*34^!"
== ""

Rebol, 144 bytes

f: func[s][l: charset[#"a"- #"z"]to-string sort/skip collect[parse sort lowercase s[any[copy t[copy o l any o](keep length? t keep o)| skip]]]2]

Ungolfed:

f: func [s] [
    l: charset[#"a" - #"z"]
    to-string sort/skip collect [
        parse sort lowercase s [
            any [
                copy t [copy o l any o] (keep length? t keep o)
                | skip
            ] 
        ]
    ] 2
]

Example usage in Rebol console:

>> f "Kitkat Tango!!"
== "1g1i1n1o2a2k3t"

>> f "Database Partitions Task"
== "1b1d1e1k1n1o1p1r2i3s4t5a"

>> f "12$*34^!"
== ""

Rebol, 149 bytes

f: func[s][l: charset[#"a"- #"z"#"A"- #"Z"]to-string sort/skip collect[parse sort s[any[copy t[copy o l any o](keep length? t keep last t)| skip]]]2]

Ungolfed:

f: func [s] [
    l: charset[#"a" - #"z" #"A" - #"Z"]
    to-string sort/skip collect [
        parse sort s [
            any [
                copy t [copy o l any o] (keep length? t keep last t)
                | skip
            ] 
        ]
    ] 2
]

Example usage in Rebol console:

>> f "Kitkat Tango"
== "1g1i1n1o2a2k3T"

>> f "Database Partitions Task"
== "1b1D1e1k1n1o1P1r2i3s4T5a"

>> f "12$*34^!"
== ""
Post Undeleted by draegtun
Post Deleted by draegtun
Source Link
draegtun
  • 1.7k
  • 10
  • 12
Loading