Skip to main content
deleted 15 characters in body
Source Link
Dennis
  • 210.6k
  • 41
  • 370
  • 825

CJam, 12 bytes

q3ew2%{$}$0=

This prints the sleepiest emoticon. Try this fiddle or [this test suite][2] in the CJam interpreter.

Credit goes to @Sp3000 for [coming up with the[the idea to use sorting][3].

How it works

q            e# Read all input from STDIN.
 3ew         e# Push all overlapping slices of length 3.
    2%       e# Keep every seconds slice. This discards non-emoticons.
      {$}$   e# Sort the slices by their sorted characters.
             e# This works since '-' < '=' < 'o'.
          0= e# Retrieve the first, minimal slice.

[2]: http://cjam.aditsu.net/#code=qN%2F%7BS%2F(%3AQ%3B1%3E%0A%20%20Q3ew2%25%7B%24%7D%240%3D%0Ae%3D%7D%2F&input=-.-%20GIVES%20-.-%0A%3D.-%20GIVES%20%3D.-%0Ao.o%20GIVES%20o.o%0Ao.-.%3D%20GIVES%20-.%3D%0A%3D.-.%3D%20GIVES%20%3D.-%20OR%20-.%3D%0Ao.-.%3D%20GIVES%20-.%3D%0A-.-.%3D%20GIVES%20-.-%0Ao.o.-%20GIVES%20o.-%0A%3D.%3D.%3D.o%20GIVES%20%3D.%3D%0A-.%3D.%3D.%3D%20GIVES%20-.%3D%0A%3D.o.-.%3D%20GIVES%20-.%3D%0Ao.-.o.%3D.%3D%20GIVES%20o.-%20OR%20-.o%20OR%20%3D.%3D%0A-.o.-.%3D.%3D%20GIVES%20-.%3D%0Ao.o.o.o.o%20GIVES%20o.o%0A-.-.-.-.-%20GIVES%20-.-%0Ao.%3D.%3D.-.-.o.o%20GIVES%20-.-%0A-.%3D.-.o.o.%3D.o.-.o.%3D.-.o.%3D.o.-%20GIVES%20-.%3D%20OR%20%3D.- [3]: http://chat.stackexchange.com/transcript/message/25556328#25556328

CJam, 12 bytes

q3ew2%{$}$0=

This prints the sleepiest emoticon. Try this fiddle or [this test suite][2] in the CJam interpreter.

Credit goes to @Sp3000 for [coming up with the idea to use sorting][3].

How it works

q            e# Read all input from STDIN.
 3ew         e# Push all overlapping slices of length 3.
    2%       e# Keep every seconds slice. This discards non-emoticons.
      {$}$   e# Sort the slices by their sorted characters.
             e# This works since '-' < '=' < 'o'.
          0= e# Retrieve the first, minimal slice.

[2]: http://cjam.aditsu.net/#code=qN%2F%7BS%2F(%3AQ%3B1%3E%0A%20%20Q3ew2%25%7B%24%7D%240%3D%0Ae%3D%7D%2F&input=-.-%20GIVES%20-.-%0A%3D.-%20GIVES%20%3D.-%0Ao.o%20GIVES%20o.o%0Ao.-.%3D%20GIVES%20-.%3D%0A%3D.-.%3D%20GIVES%20%3D.-%20OR%20-.%3D%0Ao.-.%3D%20GIVES%20-.%3D%0A-.-.%3D%20GIVES%20-.-%0Ao.o.-%20GIVES%20o.-%0A%3D.%3D.%3D.o%20GIVES%20%3D.%3D%0A-.%3D.%3D.%3D%20GIVES%20-.%3D%0A%3D.o.-.%3D%20GIVES%20-.%3D%0Ao.-.o.%3D.%3D%20GIVES%20o.-%20OR%20-.o%20OR%20%3D.%3D%0A-.o.-.%3D.%3D%20GIVES%20-.%3D%0Ao.o.o.o.o%20GIVES%20o.o%0A-.-.-.-.-%20GIVES%20-.-%0Ao.%3D.%3D.-.-.o.o%20GIVES%20-.-%0A-.%3D.-.o.o.%3D.o.-.o.%3D.-.o.%3D.o.-%20GIVES%20-.%3D%20OR%20%3D.- [3]: http://chat.stackexchange.com/transcript/message/25556328#25556328

CJam, 12 bytes

q3ew2%{$}$0=

This prints the sleepiest emoticon. Try this fiddle or [this test suite][2] in the CJam interpreter.

Credit goes to @Sp3000 for [the idea to use sorting][3].

How it works

q            e# Read all input from STDIN.
 3ew         e# Push all overlapping slices of length 3.
    2%       e# Keep every seconds slice. This discards non-emoticons.
      {$}$   e# Sort the slices by their sorted characters.
             e# This works since '-' < '=' < 'o'.
          0= e# Retrieve the first, minimal slice.

[2]: http://cjam.aditsu.net/#code=qN%2F%7BS%2F(%3AQ%3B1%3E%0A%20%20Q3ew2%25%7B%24%7D%240%3D%0Ae%3D%7D%2F&input=-.-%20GIVES%20-.-%0A%3D.-%20GIVES%20%3D.-%0Ao.o%20GIVES%20o.o%0Ao.-.%3D%20GIVES%20-.%3D%0A%3D.-.%3D%20GIVES%20%3D.-%20OR%20-.%3D%0Ao.-.%3D%20GIVES%20-.%3D%0A-.-.%3D%20GIVES%20-.-%0Ao.o.-%20GIVES%20o.-%0A%3D.%3D.%3D.o%20GIVES%20%3D.%3D%0A-.%3D.%3D.%3D%20GIVES%20-.%3D%0A%3D.o.-.%3D%20GIVES%20-.%3D%0Ao.-.o.%3D.%3D%20GIVES%20o.-%20OR%20-.o%20OR%20%3D.%3D%0A-.o.-.%3D.%3D%20GIVES%20-.%3D%0Ao.o.o.o.o%20GIVES%20o.o%0A-.-.-.-.-%20GIVES%20-.-%0Ao.%3D.%3D.-.-.o.o%20GIVES%20-.-%0A-.%3D.-.o.o.%3D.o.-.o.%3D.-.o.%3D.o.-%20GIVES%20-.%3D%20OR%20%3D.- [3]: http://chat.stackexchange.com/transcript/message/25556328#25556328

Source Link
Dennis
  • 210.6k
  • 41
  • 370
  • 825

CJam, 12 bytes

q3ew2%{$}$0=

This prints the sleepiest emoticon. Try this fiddle or [this test suite][2] in the CJam interpreter.

Credit goes to @Sp3000 for [coming up with the idea to use sorting][3].

How it works

q            e# Read all input from STDIN.
 3ew         e# Push all overlapping slices of length 3.
    2%       e# Keep every seconds slice. This discards non-emoticons.
      {$}$   e# Sort the slices by their sorted characters.
             e# This works since '-' < '=' < 'o'.
          0= e# Retrieve the first, minimal slice.

[2]: http://cjam.aditsu.net/#code=qN%2F%7BS%2F(%3AQ%3B1%3E%0A%20%20Q3ew2%25%7B%24%7D%240%3D%0Ae%3D%7D%2F&input=-.-%20GIVES%20-.-%0A%3D.-%20GIVES%20%3D.-%0Ao.o%20GIVES%20o.o%0Ao.-.%3D%20GIVES%20-.%3D%0A%3D.-.%3D%20GIVES%20%3D.-%20OR%20-.%3D%0Ao.-.%3D%20GIVES%20-.%3D%0A-.-.%3D%20GIVES%20-.-%0Ao.o.-%20GIVES%20o.-%0A%3D.%3D.%3D.o%20GIVES%20%3D.%3D%0A-.%3D.%3D.%3D%20GIVES%20-.%3D%0A%3D.o.-.%3D%20GIVES%20-.%3D%0Ao.-.o.%3D.%3D%20GIVES%20o.-%20OR%20-.o%20OR%20%3D.%3D%0A-.o.-.%3D.%3D%20GIVES%20-.%3D%0Ao.o.o.o.o%20GIVES%20o.o%0A-.-.-.-.-%20GIVES%20-.-%0Ao.%3D.%3D.-.-.o.o%20GIVES%20-.-%0A-.%3D.-.o.o.%3D.o.-.o.%3D.-.o.%3D.o.-%20GIVES%20-.%3D%20OR%20%3D.- [3]: http://chat.stackexchange.com/transcript/message/25556328#25556328