(defpackage "ODAI-PT15-467" (:use "COMMON-LISP"))
(in-package "ODAI-PT15-467")
(defun groups (seq &key (test #'eql) (key #'identity))
(loop for start = 0 then end
for end = (position-if (lambda (x)
(not (funcall test
(funcall key (elt seq start))
x)))
seq
:start start
:key key)
collect (subseq seq start end)
while end))
(defun odai-pt15-467 (s)
(apply #'concatenate 'string
(mapcar (lambda (x)
(format nil "~A~A"
(elt x 0)
(if (> (length x) 1) (length x) "")))
(groups s))))
(dolist (s '("あいうえお"
"ああいいうう"
"あいうあいう"
"ああああ"
"🐤🐤🐤🐤"))
(write-line (odai-pt15-467 s)))
KGRlZnBhY2thZ2UgIk9EQUktUFQxNS00NjciICg6dXNlICJDT01NT04tTElTUCIpKQooaW4tcGFja2FnZSAiT0RBSS1QVDE1LTQ2NyIpCgooZGVmdW4gZ3JvdXBzIChzZXEgJmtleSAodGVzdCAjJ2VxbCkgKGtleSAjJ2lkZW50aXR5KSkKICAobG9vcCBmb3Igc3RhcnQgPSAwIHRoZW4gZW5kCiAgICAgICAgZm9yIGVuZCA9IChwb3NpdGlvbi1pZiAobGFtYmRhICh4KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobm90IChmdW5jYWxsIHRlc3QKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZnVuY2FsbCBrZXkgKGVsdCBzZXEgc3RhcnQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHgpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOnN0YXJ0IHN0YXJ0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6a2V5IGtleSkKICAgICAgICBjb2xsZWN0IChzdWJzZXEgc2VxIHN0YXJ0IGVuZCkKICAgICAgICB3aGlsZSBlbmQpKQoKKGRlZnVuIG9kYWktcHQxNS00NjcgKHMpCiAgKGFwcGx5ICMnY29uY2F0ZW5hdGUgJ3N0cmluZwogICAgICAgICAobWFwY2FyIChsYW1iZGEgKHgpCiAgICAgICAgICAgICAgICAgICAoZm9ybWF0IG5pbCAifkF+QSIKICAgICAgICAgICAgICAgICAgICAgICAgICAgKGVsdCB4IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgIChpZiAoPiAobGVuZ3RoIHgpIDEpIChsZW5ndGggeCkgIiIpKSkKICAgICAgICAgICAgICAgICAoZ3JvdXBzIHMpKSkpCgooZG9saXN0IChzICcoIuOBguOBhOOBhuOBiOOBiiIKICAgICAgICAgICAgICLjgYLjgYLjgYTjgYTjgYbjgYYiCiAgICAgICAgICAgICAi44GC44GE44GG44GC44GE44GGIgogICAgICAgICAgICAgIuOBguOBguOBguOBgiIKICAgICAgICAgICAgICLwn5Ck8J+QpPCfkKTwn5CkIikpCiAgKHdyaXRlLWxpbmUgKG9kYWktcHQxNS00NjcgcykpKQo=