text:
Is it really a comcoin?
Very interesting background
Comcoins are a currency like any other. The residents of Multibaseania (an economically robust system of city-states with very few residents in a galaxy far, far away) use Comcoins to conduct transactions between themselves. Comcoins are represented by unique codes on special not-paper slips, and when you pay you give the vendor your slip.
However, just like any currency, there are those villainous types that try to take advantage of the system and inflate the currency because they are bored.
To combat this unquestionably illegal behavior, the Multibaseanian governments came together and devised a way to prove that the money is legitimate. The top idea from the think tank was: whenever a Comcoin is given to a vendor, the vendor runs a program that checks if it is legitimate. How does one know if a Comcoin is legitimate?

A legitimate Comcoin is one where:
When the Comcoin's unique code is converted into the bases 2-10, inclusive, that number is composite (i.e. not prime). Also, all of the unique code's digits in base 10 are either 1 or 0, and its length in base 10 is between 1 and 5 inclusive.

Very important example: in base 5, 111 is 421. Even though 111 is not prime, 421 is, so the Comcoin is invalid.
The challenge
Write a function or program that takes a Comcoin's code (a number), which is in base 10 and is an integer. Then, print or return a truthy or falsy value depending on whether that Comcoin is legitimate (criteria above), respectively.
I/O examples
Input     Output

101         False // because it is prime in base 2
1010        True
10101       True
1010111     False // because it is longer than 5 digits
123         False // because it does not contain *only* 0's and 1's
10111       False // because it is prime in base 6

This is code golf, so shortest code in bytes wins!
Edit
A Comcoin is not a number that is not prime, but is a number that is composite.
Inspiration from qualification round of Google CodeJam 2016.

Related...

Also related

What's with all the primality testing and base conversion? I know this was inspired by a Google code jam question, but I feel like these topics have been way overdone on PPCG. And my comments from here also apply.

What about an input of 1? It's not composite in any base, nor is it prime. Is it a legitimate Comcoin?

"When the Comcoin's unique code is converted into the bases 2-10, inclusive, that number is composite" makes no sense. The divisibility properties of a number are independent of the way the number is represented.

@MartinBüttner, not really. I think that what is going on is that the base-b representation of the number is interpreted as though it were in base 10, which is a two-step process, so the wording needs to show the two steps.

@PeterTaylor Yeah, I just noticed. I assumed this was the same as the GCJ challenge, but you're right it seems to be the other way round. So convert to base n and then reinterpret as base 10.

"To minimize the risk of SpaceWikiLeaks finding out about this whole manoeuvre, the code needs to be as short as possible"

I keep reading this as "Is this a comicon"

Well you definitely solved the inflation problem if you can only ever mint 18 comcoins...

Having to explicitly check for invalid input is annoying and in some submissions ends up being longer than the actual core of the problem.

@Mego all the challenge is about distinction between valid input and invalid input

Still no answer about input 1 ...

@edc65 The meat of the challenge is "determine if a number is composite in all bases 2-10". Having to also handle invalid input (too long or too short and not all digits are 0 or 1) unnecessarily complicates the challenge. Handling invalid input was not a part of the original Google Code Jam challenge, and I'm not sure why the author felt the need to tack that on when they copied the challenge and posted it here.

@Mego you mean this other challenge http://codegolf.stackexchange.com/questions/77541/primes-in-different-bases#comment189244_77541. Here many answers including mine have no composite/primality check at all

@edc65 No I mean the Google Code Jam challenge linked on the first comment

If you're going to argue over 1, what about 0? I'd really like it to be invalid, as that will cut my answer by about 40%.

@KevinLau - as just 1 is not composite (even though it is not prime), it is not a Comcoin

@Neil , see edit

MATL, 20 bytes
n6<G50<9:Q"G@ZAZp~vA

Input is a string.
Try it online!
Explanation
n6<    % take input implicitly. Is length less than 6?
G50<   % push input again. Array that contains true for digits less than 2
9:Q    % push array of bases: [2,3,...,10]
"      % for each
  G    %   push input again
  @    %   push current base
  ZA   %   interpret input as if it were in that base, and convert to decimal
  Zp~  %   true for composite numbers
  v    %   concatenate vertically all results up to now
  A    %   true if all results were
       % end for each implicitly
       % display implicitly

Python 2, 62 56 49 bytes
lambda n:max(`n`)<"2"and 0x5d75d750>>int(`n`,2)&1

Credit to @Sp3000 for the max trick to ensure binary digits.

A black magic hardcode of all relevant primes? Nice, how does it work?

@KevinLau It's function should be apparent once you realize how many 5-digit binary numbers there are :)

You left out 1111.

@xsot Fixed, had a little bug in my generation script.

wow... that's clever.

JavaScript (ES6), 38 27 bytes
n=>2641714512>>'0b'+n&n<1e5

Port of @orlp's Python answer, except that JavaScript's precedence and weak typing allows me to shift the integer even if it's not valid in base 2, and then bitwise and it with the boolean. Returns 0 or 1 as appropriate. Note that I'm not using @orlp's constant any more, instead I'm assuming the following list of comcoins is valid:

 100
 110
 1000
 1010
 1011
 1100
 1110
 10000
 10010
 10100
 10101
 10110
 11000
 11010
 11011
 11100
 11111

Edit: Fixed to check the length of the comcoin, since JavaScript's shift operator works modulo 32.

Julia, 83 81 bytes
f(x,s="$x")=endof(s)<6&&all(c->c∈"01",s)&&!any(b->isprime(parse(Int,s,b)),2:10)

This is a function that accepts an integer and returns a boolean. It's a straightforward check on the conditions of being a Comcoin:

Length as a string between 1 and 5 inclusive: endof(s)<6
All zeros and ones: all(c->c∈"01",s)
No primes in any base from 2 to 10: !any(b->isprime(parse(Int,s,b)),2:10)

Saved 2 bytes thanks to Luis Mendo!

JavaScript (ES6), 37
This should work better than the current ES6 answer Now the other ES6 answer is clearly better
Edit 0 and 1 not valid, the magic number changes
n=>180006585..toString(2)['0b'+n-4]|0

Test (see below to see how the magic number is built)

F=n=>180006585..toString(2)['0b'+n-4]|0

console.log=(...x)=>O.textContent+=x+'\n'

function test() {
  var x=+I.value
  console.log(x+' '+F(x))
}

test()

// How the mask is built

isPrime=x=>{
  if(x<=2)return x==2
  if(x%2==0)return false
  var i,q=Math.sqrt(x)
  for(i=3;i<=q;i+=2)
    if(x%i==0)return false
  return true;
}

buildMask=_=>{
  var n,m,i,p,mask=''
  for(i=1;i<32;i++)
  {
    n=+i.toString(2)
    for(p=0,b=10;b>1;--b)
    {
      m=+n.toString(b)
      p=m<2 || isPrime(m)
      if(p)
      {
        console.log('N',i,n,m,b)
        break;
      }
    }
    mask+=p?0:1
    if(!p) console.log('Y',i,n)
  }
  console.log(mask, parseInt(mask,2))
  // result
  // 0001010101110101010111010111001,180006585}
}
<input value='11111' type='number' id=I oninput='test()'>

Ruby, 81 80 74 bytes
Anonymous function, takes input as a string and returns true or a falsy value (false if it fails a prime check, nil if it contains characters that aren't 0 or 1)
Uses some regex magic suggested by @QPaysTaxes, which thankfully works (within reasonable time) because of the promise that the coin signature has max 5 characters. Also, I forgot to actually check for the length, so only 1 byte was saved overall.
Since 0 and 1 aren't composite numbers in any base, I could save more bytes by modifying my regex.
->n{n=~/^[01]{2,5}$/&&(2..10).map{|b|?1*n.to_i(b)=~/^(..+?)\1+$/}&[p]==[]}

Old version using Ruby's built-in prime checker. 85 bytes after properly checking for length.
->n{require'prime';n=~/^[01]{1,5}$/&&(2..10).map{|b|Prime.prime? n.to_i(b)}&[!p]==[]}

As a side note, you can check primality in fewer bytes with this dark magic: '1'*n.to_i(b) !~/^1?$|^(11+?)\1+$/. Or at least I think you can. To be honest, I have no idea how that works, so it might not.

Oh! A regex pattern for composite numbers, and a check to make sure it doesn't match. Yeah, that'll work. (The black magic works by turning the number into a string of 1s and uses regex groups to find a pair of numbers that will multiply and fit the pattern.)

Mathematica, 97 bytes
#<1*^5&&Tr@DigitCount[#][[2;;-2]]<1&&FromDigits@IntegerDigits[#,a+1]~Table~{a,9}~NoneTrue~PrimeQ&

Hey, at least I tried...
#<1*^5&&Tr@DigitCount[#][[2;;-2]]<1&&FromDigits@IntegerDigits[#,a+1]~Table~{a,9}~NoneTrue~PrimeQ&
#<1*^5&&                                                                                less than 100000?
        Tr@DigitCount[#][[2;;-2]]<1&&                                                             no digits 2-9?
                                     FromDigits@IntegerDigits[#,a+1]~Table~{a,9}~NoneTrue~PrimeQ& composite in all bases?

05AB1E, 18 17 bytes
ΘIg5›ITLBpàI1K`O_

-1 byte and bug-fix thanks to @Grimmy.
Outputs 1/0 for truthy/falsey respectively.
Try it online or verify all test cases or verify the first 40 binary numbers and 100 regular numbers.
(Now longer) 18 bytes alternative:
46bICèIт@Ig6‹PITм+

Outputs 1 for truthy and a non-1 integer for falsey (note: only 1 is truthy in 05AB1E, so this is allowed according to the meta).
Try it online or verify all test cases or verify the first 40 binary numbers and 100 regular numbers.
Both programs also works for edge-case 1, unlike some other answers.
Explanation:
Θ       # Check if the (implicit) input is exactly 1 (1 if 1; 0 otherwise)
Ig      # Push the input again, and pop and push its length
  5›    # Check if this length is larger than 5 (1 if length>5; 0 if length<=5)
I       # Push the input again
 TL     # Push a list in the range [1,10]
   B    # Convert the input to each of those bases
    p   # Check for each whether it is a prime (1 if prime; 0 if not)
     à  # Pop and push the maximum to check if any are a prime
I       # Push the input yet again
 1K     # Remove all 1s
   `    # And push all remaining digits separated to the stack
O       # Sum all values on the stack
 _      # And check whether it is exactly 0 (1/truthy if 0; 0/falsey if >0)
        # (after which this result is output implicitly)

46b     # Push 46 as binary: 101110
   IC   # Push the input, and convert it from binary to an integer
        # (NOTE: unfortunately also works for non-binary inputs, so we'll fix those later)
     è  # Use that to index into the 101110 (0-based and with wraparound)
Iт@     # Push the input again, and check that it's >= 10
Ig6‹    # Push the input again, and check that its length is < 6
P       # Take the product of all values on the stack
 I      # Push the input again
  Tм    # Remove all 1s and 0s
    +   # And add any remaining digits to the product
        # (after which the result is output implicitly)

Factor, 128 bytes
[ dup [| a | 2 10 [a,b] [ a swap base> prime? not ] all? ] swap [ [ [ 49 = ] [ 48 = ] bi or ] all? ] [ length 6 < ] bi and and ]

I'll try to golf this more in a sec.
Well, here's the less golfed version I thought might be shorter, but it's 133 bytes...
[ [ [let :> a 2 10 [a,b] [ a swap base> prime? not ] all? ] ] [ [ [ [ 49 = ] [ 48 = ] bi or ] all? ] [ length 6 < ] bi ] bi and and ]

Actually ungolfed:
: comcoin? ( a -- t/f )
  [
    [let :> a
      2 10 [a,b] [ a swap base> prime? not ] all?
    ]
  ] [
    [ [ [ 49 = ] [ 48 = ] bi or ] all? ]
    [ length 6 < ] bi
  ] bi
  and and ;

Python, 161 152 bytes
Sigh. Assign the lambda to use it.
def p(n):
 i=a=n
 while i>2:i-=1;a*=n%i
 return a>1
lambda s:all([all(map(lambda i:not p(int(s,i)),range(2,11))),filter(lambda i:i in"01",s)),len(s)<6])

Python 3, 222 bytes
I wanted to try to do the naive method purely functionally, without looping. Here it is.
(lambda A:all([F(A)for F in[lambda r:all(map(lambda s:not(lambda i,b:lambda n:list(filter(lambda i:not n%i,range(2,n)))(int(i,b))(r,s),range(2,11))),lambda r:0!= len(filter(lambda d:d not in"01",r)),lambda r:0<len(r)<6]]))

Ungolfed:
(lambda A:
    all(
        [F(A) for F in [
            lambda r: all(
                map(
                    lambda s:
                        not(
                            lambda i, b:
                                lambda n:
                                    list(filter(
                                        lambda i: not n % i, range(2, n)))
                            )(int(i, b))(r, s),
                            range(2, 11))),
            lambda r: 0 != len(filter(lambda d: d not in "01", r)),
            lambda r: 0 < len(r) < 6
            ]
        ]
    )
)


text:
All together now
Given a list of digits 1 through 9, output whether each digit is grouped together as a single contiguous block. In other words, no two of the same digit are separated by different digits. It's OK if a digit doesn't appear at all. Fewest bytes wins.
Input: A non-empty list of digits 1 through 9. This can be as a decimal number, string, list, or similar sequence.
Output: A consistent Truthy value if all the digits are grouped in contiguous blocks, and a consistent Falsey value if they are not.
True cases:
3
51
44999911
123456789
222222222222222222222

False cases:
818
8884443334
4545
554553
1234567891

var QUESTION_ID=77608,OVERRIDE_USER=20260;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/77608/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

Would a list of singleton strings be an acceptable input format?

Yes, singletons are fine.

Can anyone tell me what the most efficient algorithm for this problem would be?  Or is there a more general problem that this falls under that I can look up?

@amt528 You can do it in linear time by iterating over each digit and checking that there's no runs of it past the first.

Could you provide an example of how it's implemented?

Python 3, 38 34 33 bytes
lambda s:s==sorted(s,key=s.index)

This expects a list of digits or singleton strings as argument. Test it on Ideone.
Thanks to @xsot for golfing off 4 bytes!
Thanks to @immibis for golfing off 1 byte!

If you are allowed to accept a list of strings instead, you can shorten this to lambda s:s==sorted(s,key=\s`.find)`

Ah, I tried taking a list, but I didn't think of using backticks... I'll ask the OP.

Am I missing something - why can't you just use s.find?

@immibis s has to be a list of singleton strings (or I'd have to cast s to list for the comparison), and list.find is not defined...

@Dennis s.index then? Seems to work for me.

@immibis Yes, that works. Thanks!

JavaScript (ES6), 27 bytes
s=>!/(.)(?!\1).*\1/.test(s)

Uses negative lookahead to look for two non-contiguous digits. If at least two such digits exist, then they can be chosen so that the first digit precedes a different digit.

Or, just use a regex XD. That works too.

ahem Retina ahem

05AB1E, 4 bytes
Code:
Ô¹ÙQ

Explanation:
Ô     # Push connected uniquified input. E.g. 111223345565 would give 1234565.
 ¹    # Push input again.
  Ù   # Uniquify the input. E.g. 111223345565 would give 123456.
   Q  # Check if equal, which yields 1 or 0.

Uses CP-1252 encoding.
Try it online!

You...just beat jelly...I never thought this was possible...

Jelly, 5 bytes
ĠIFPỊ

Try it online!
How it works
ĠIFPỊ  Main link. Input: n (list of digits or integer)

Ġ      Group the indices of n by their corresponding values, in ascending order.
       For 8884443334, this yields [[7, 8, 9], [4, 5, 6, 10], [1, 2, 3]].
 I     Increments; compute the all differences of consecutive numbers.
       For 8884443334, this yields [[1, 1], [1, 1, 4], [1, 1]].
  F    Flatten the resulting 2D list of increments.
   P   Product; multiply all increments.
    Ị  Insignificant; check if the product's absolute value is 1 or smaller.

Five bytes you say? What kind of encoding is that?

Jelly has its own code page, which encodes each of the 256 characters it understands as a single byte.

Pyth, 6 5 bytes
1 bytes thanks to FryAmTheEggman
SIxLQ

Inspired by the Python solution here.
Test suite
Explanation:
SIxLQ
  xLQ   Map each element in the input to its index in the input. Input is implicit.
SI      Check whether this list is sorted.

SIxLQ seems to work.

This is genius.

The second Q doesn't seem to get parsed properly, it swaps argument order or something so you get all 0s and it always gives true. Here's a test suite.

R, 66 48 46 43 38 bytes
function(s)!any(duplicated(rle(s)$v))

This is a function that accepts the input as a vector of digits and returns a boolean. To call it, assign it to a variable.
Not the shortest but I thought it was a fun approach. We run length encode the input and extract the values. If the list of values contains duplicates then return FALSE, otherwise return TRUE.
Verify all test cases online
Saved 20 bytes thanks to MickyT, 3 thanks to Albert Masclans, and 5 thanks to mnel!

26 by switching to latest R version and using table.

MATL, 8 bytes
t!=tXSP=

The output is an array containing only ones for truthy, or an array containing at least one zero for falsey.
Try it online!
Explanation
Consider the input 22331, which satisfies the condition. Testing if each character equals each other gives the 2D array
1 1 0 0 0
1 1 0 0 0
0 0 1 1 0
0 0 1 1 0
0 0 0 0 1

The final result should be truthy if the rows of that array (with rows considered as atomic) are in decreasing lexicographical order. For comparison, input 22321 gives the array
1 1 0 1 0
1 1 0 1 0
0 0 1 0 0
1 1 0 1 0
0 0 0 0 1

in which the rows are not in order.
t!   % Take string input. Duplicate and tranpose
=    % Test for equality, element-wise with broadcast: gives a 2D array
     % that contains 0 or 1, for all pairs of characters in the input
t    % Duplicate
XS   % Sort rows (as atomic) in increasing order
P    % Flip vertically to obtain decreasing order
=    % Test for equality, element-wise

Java, 161 156 bytes
Because Java...
Shamelessly stealing borrowing the regex from this answer because I started out trying to do this with arrays and math manipulation, but it got hideously complex, and regex is as good a tool as any for this problem.
import java.util.regex.*;public class a{public static void main(String[] a){System.out.println(!Pattern.compile("(.)(?!\\1).*\\1").matcher(a[0]).find());}}

Ungolfed:
import java.util.regex.*;

public class a {
    public static void main(String[] args) {
        System.out.println(!Pattern.compile("(.)(?!\\1).*\\1").matcher(args[0]).find());
    }

Laid out like a sensible Java person:
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class  {
    public static void main(String[] args) {
        Pattern p = Pattern.compile("(.)(?!\\1).*\\1");
        Matcher m = p.matcher(args[0]);
        System.out.println(!m.find());
    }
}

like a sensible Java person That would be, not using Java ever.

Other solutions are just providing a function, would make it a lot shorter. Something like s->s.match("(.)(?!\\1).*\\1")

But then we couldn't revel in the verboseness of the answer.

Retina, 17 bytes
M`(.)(?!\1).+\1
0

Try it online! (Slightly modified to run all test cases at once.)
The first regex matches digits which are separated by other digits, so we get a 0 for valid inputs and anywhere between 1 and 9 for invalid inputs (due to the greediness of the the .+, we can't get more than n-1 matches for n different digits).
To invert the truthiness of the result, we count the number of 0s, which is 1 for valid inputs and 0 for invalid ones.

I made a shorter one, but it's close enough to yours that it should be a comment instead. Use AntiGrep instead of Match, then remove the last line: A`(.)(?!\1).+\1 for 15 bytes. Also works for multiple inputs. Truthy is the input, falsy is nothing. One does not simply out-golf Martin at his own language. :)

@mbomb007 I think I actually considered that, but unfortunately, the challenge asks for a consistent truthy (and falsy) value, so printing the input as truthy isn't allowed.

J, 8 bytes
-:]/:i.~

Test it with J.js.
How it works
-:]/:i.~  Monadic verb. Argument: y (list of digits)

     i.~  Find the index in y of each d in y.
  ]/:     Sort y by the indices.
-:        Match; compare the reordering with the original y.

:] :i :-1

Not sure if joke or golfing suggestion...

Regex (Perl / PCRE / Java / Boost / Pythonregex / Ruby), 17 bytes
^(?!(.)+\1*+.+\1)

Try it online! - Perl
Try it online! - PCRE
Try it online! - Java
Try it online! - Boost
Try it online! - Python import regex
Try it online! - Ruby
^             # Anchor to start of string
(?!           # Assert that the following can't match:
    (.)+      # Skip any number of characters (minimum zero), then capture
              # the next character in \1
    \1*+      # Skip all subsequent occurrences of \1, and lock in that match
              # using a possessive quantifier.
    .+        # Skip at least one character, or as many as necessary to make the
              # following match:
    \1        # Match the character captured in \1
)

Regex (Perl / PCRE / Java / Boost / Pythonregex / Ruby), 11 bytes
(.)\1*+.+\1

Returns a match for false, and a non-match for true.
Try it online! - Perl
Try it online! - PCRE
Try it online! - Java
Try it online! - Boost
Try it online! - Python import regex
Try it online! - Ruby
This beats the regex in the previous Java answer, Perl answer, and Ruby answer by 2 bytes.
(.)   # \1 = a character anywhere in the string
\1*+  # Skip all subsequent occurrences of \1, and lock in that match using a
      # possessive quantifier.
.+    # Skip at least one character, or as many as necessary to make the
      # following match:
\1    # Match the character captured in \1

Regex (ECMAScript (or better) / Python / .NET), 13 bytes
(.)(?!\1).+\1

Returns a match for false, and a non-match for true.
Try it online! - ECMAScript
Try it online! - Perl
Try it online! - PCRE
Try it online! - Java
Try it online! - Boost
Try it online! - Python
Try it online! - Python import regex
Try it online! - Ruby
Try it online! - .NET
\$\large\textit{Anonymous functions}\$
Ruby, 21 bytes
->s{/(.)\1*+.+\1/!~s}

Try it online!
JavaScript (ES6), 27 bytes
s=>!/(.)(?!\1).+\1/.test(s)

Try it online!
Included for completeness; already done in Neil's answer.
PowerShell, 29 bytes
!($args-match'(.)(?!\1).+\1')

Try it online!
Julia v0.7+, 30 bytes
s->!occursin(r"(.)\1*+.+\1",s)

Attempt This Online! / Try it online!
Julia v1.3+, 28 bytes
s->count(r"(.)\1*+.+\1",s)<1

Attempt This Online!
-2 bytes compared to v0.7+, thanks to MarcMush
R, 32 bytes
\(s)!grepl('(.)\\1*+.+\\1',s,,1)

Attempt This Online!
Beaten by Alex A.'s non-regex answer by 2 bytes, or by 6 bytes with pajonk's improvement.
Java, 33 bytes
s->!s.matches("(.)+\\1*+.+\\1.*")

Try it online!
PHP, 39 bytes
fn($s)=>!preg_match('/(.)\1*+.+\1/',$s)

Try it online!
\$\large\textit{Full programs}\$
Perl -p, 17 bytes (18 bytes including flag)
$_=!/(.)\1*+.+\1/

Try it online!
Retina 0.8.2, 17 bytes
M`(.)(?!\1).+\1
0

Try it online!
Included for completeness; already done in Martin Ender's answer.
Retina 1.0, 17 bytes
C`(.)(?!\1).+\1
0

Try it online!
Pip, 19 18 bytes
`(.)(?!\1).+\1`NIa

Try it online!
Thanks to DLosc.

Alex A.'s answer does work correctly but takes vector of digits/characters as input, but can be 26

@pajonk Thanks, edited. It also works with utf8ToInt() instead of el(strsplit(,"")).

13 bytes in Python re flavor with match = falsey / no match = truthy: (.)(?!\1).+\1 (Try it online!)

(Note: the Pip program can be 18 bytes because the space isn't necessary.)

Julia, 28 bytes: s->count(r"(.)\1*+.+\1",s)<1

Pyth, 7 bytes
{IeMrz8

Test Suite.

Ruby, 23 bytes
Anonymous function. Accepts a string. Regex strat.
->n{/(.)(?!\1).*\1/!~n}

Regex breakdown
/(.)(?!\1).*\1/
 (.)            # Match a character and save it to group 1
    (?!\1)      # Negative lookahead, match if next character isn't
                #  the same character from group 1
          .*    # Any number of matches
            \1  # The same sequence as group 1

!~ means if there are no matches of the regex within the string, return true, and otherwise return false.

MATL, 13 11 bytes
u"G@=fd2<vA

Thanks to Luis Mendo for saving two bytes!
Try it Online!
Explanation
        % Grab the input implicitly
u       % Find the unique characters
"       % For each of the unique characters
    G   % Grab the input again
    @=  % Determine which chars equal the current char
    f   % Find the locations of these characters
    d   % Compute the difference between the locations
    2<  % Find all index differences < 2 (indicating consecutive chars)
    v   % Vertically concatenate all stack contents
    A   % Ensure that they are all true
        % Implicit end of the for loop

You can take the input with quotes (allowed by default) and remove j. Also, I think you can move vA within the loop and remove ]

@LuisMendo Thanks! I had messed around with putting Y& inside but that didn't work because fd2< can be empty. Moving vA inside works great though! Also I really wish we had a stable unique that didn't take up tons of bytes.

Now stable unique takes a little less, using a number instead of the predefined string. I may add a shorter version in the future, though. Or just make u stable by default (you could always include S afterwards, two bytes). What do you think?

Mathematica, 26 bytes
0<##&@@Sort[#&@@@Split@#]&

Haskell, 37 bytes
f l=(==)=<<scanl1 min$(<$>l).(==)<$>l

Try it online!
Uses the same approach as Luis Mendo's MATL answer: creates a vector for each entry which indices equal it, and checks that the result is sorted in decreasing order.
(<$>l).(==)<$>l is shorter version of [map(==a)l|a<-l]. The function (<$>l).(==) that takes a to map(==a)l is mapped onto l.
scanl1 min takes the cumulative smallest elements of l, which equals the original only if l is reverse-sorted. (==)=<< checks if the list is indeed invariant under this operation.
A recursive strategy also gave 37 bytes:
f(h:t)=t==[]||f t>(elem h t&&h/=t!!0)

Try it online!
This checks each suffix to see if its first element doesn't appear in the remainder, excusing cases where the first two elements are equal as part of a contiguous block.
Other approaches:
42 bytes
f l=and[all(/=a)t|a:b:t<-scanr(:)[]l,a/=b]

Try it online!
43 bytes
import Data.List
((==)<*>nub).map nub.group

Try it online!

Jelly, 4 bytes
i@ÞƑ

Try it online!
Semi-based on several of DLosc's 5-byters.
   Ƒ    The input is not changed by
  Þ     sorting its elements by
i@      their first indices in the input.

Kind of like cutting the F out of ¹ƙ`F⁼, but also kind of like cutting the `ṢƑ out of iⱮ`ṢƑ.

@thejonymyster Should be clearer now

Vyxal, 4 bytes
)ġf⁼

Try it Online!
Takes input as a list of singleton strings. Happens to be a different algorithm to the existing vyxal answer.
Explained
)ġf⁼
)ġ    # Group by the identity function, by order of first appearance.
  f   # Flatten the list
   ⁼  # Does that equal the input?

what is the diamond emoji for?

It means it was created with the help of Luminespire

Python, 56 55 bytes
a=lambda s:~(s[0]in s.lstrip(s[0]))&a(s[1:])if s else 1

Fails in Python 3.4.1 (int not subscriptable)

Saved an extra byte with ~(which literally is equivalent to1-): a=lambda s:~(s[0]in s.lstrip(s[0]))&a(s[1:])if s else 1

Haskell, 44 bytes
import Data.List
((==)<*>nub).map head.group

Usage example: ((==)<*>nub).map head.group $ "44999911" -> True.
A non-pointfree version:
f x = q == nub q                -- True if q equals q with duplicates removed
  where
  q = map head $ group x        -- group identical digits and take the first
                                -- e.g. "44999911" -> ["44","9999","11"] -> "491"
                                -- e.g  "3443311" -> ["3","44","33","11"] -> "3431"

C#, 119 bytes
bool m(String s){for(int i=0;i<9;i++){if(new Regex(i.ToString()+"+").Matches(s).Count>1){return false;}}return true;}

Ungolfed
bool m(String s) {
    for(int i=0;i<9;i++) {
        if(new Regex(i.ToString() + "+").Matches(s).Count > 1) {
            return false;
        }
    }

    return true;
}

Welcome to PPCG! Instead of deleting a post and making a new post with the fixed version, you could also edit your old post and then undelete it. (No need to do that now that there's two posts already anyway, but just so you know in the future.)

My bad. When I first intended to participate in this Code Golf I misread the objective and didn't had much time to do another solution ( and knowing myself, I wouldn't try to correct the previous posted solution ). But then I was told I had some more time free and attempted to post the "correct solution". Didn't even thought in doing what you said. Next time I'll have that in mind!

No problem at all, I hope you'll have a good time in the community. :)

Brachylog, 5 4 bytes
≡ᵍc?

Try it online!
-1 thanks to DLosc
Takes input as a list of digits through the input variable, and succeeds or fails as output.
≡ᵍ      The input with identical elements grouped in order of first appearance
  c     with the groups concatenated
   ?    is the input.

Vyxal, 4 bytes
vḟÞṠ

Try it Online!
vḟ  # Index of B in A, vectorized (B will be each individual character in the
    # string / item in the list, and A will be the string/list itself)
ÞṠ  # Is the result sorted?

Answers that use this method, in chronological order:

Dennis – Python, 33 bytes
isaacg – Pyth, 5 bytes
Dennis - Julia, 30 bytes
Dennis - J, 8 bytes
DLosc – BQN, 5 bytes
DLosc – Jelly, 5 bytes
Unrelated String – Jelly, 4 bytes

Vyxal, 5 bytes
₌ÞǓU=

Try it Online!
₌     # Parallel Apply - apply the following two elements to the input and keep
      # both results on the stack.
  ÞǓ  # Connected Uniquify - Remove occurences of adjacent duplicates.
  U   # Uniquify - Remove all duplicates.
=     # Are the two results equal?

Turned out to be a port of Adnan's 05AB1E answer.

K (ngn/k), 11 10 bytes
-1 byte thanks to @ovs
~/,/'='^:\

Try it online!
^: test for spaces - always returns 0s, as the input consists only of digits. The : here means monadic.
^:\ repeat until convergence. This will return a pair of the original argument and a list of 0s of the same length as the argument.
=' group each. To "group" a list means to make a dictionary that maps each distinct element of the list to the positions where it occurs.
,/' raze each, i.e. ignore the keys and concatenate the values. For the list of all 0s this will result in 0,1,...,length-1. For the other list, it will depend on the presence of non-continuous blocks - if there aren't any, the result will be 0,1,...,length-1 too.
~/ do they match?

I think the #:'\ can be ^:\

@ovs well spotted, thanks!

Prolog (SWI), 40 bytes
\[A|S]:-S=[];(S=[A|_];\+member(A,S)),\S.

Try it online!
-3 thanks to Jo King
Similar to xnor's second Haskell answer.
This won't work on TIO because it is too old of a version, and it's longer, but I think it's more interesting:
Prolog (SWI), 57 bytes
\A:-clumped(A,B),maplist([X-_,X]>>!,B,C),list_to_set(A,C).

Julia, 35 bytes
s->issorted(s,by=x->findfirst(s,x))

For whatever reason, sort does not take a string, but issorted does...

...Are strings not immutable arrays in Julia like Python? That would make me really sad.

Yes, strings are immutable. That's probably why issorted works, but sort doesn't.

There isn't a sorting method defined for strings, but it wouldn't work if they were processed in the same way as one-dimensional arrays because those are sorted by performing an in-place sort of a copy, and as you said, strings are immutable. It's not a problem for checking for sorted order though because it's implemented as a simple loop over an iterable, which is fine for strings. Just some trivia. ¯\(ツ)/¯

@AlexA. So very much like Python in fact; the difference is that Python's builtin sorted turns its iterable argument into a mutable list first -- that's why sorted(string) returns a list of strings

Lua, 107 94 85 Bytes
13 bytes saved thanks to @LeakyNun
At least, it beats Java :D. Lua sucks at manipulating strings, but I think it is good enough :).
It takes its input as a command-line argument, and outputs 1 for truthy cases and false for falsy ones. Now outputs using its exit code. Exit code 0 for truthy, and 1 for falsy
o=os.exit;(...):gsub("(.)(.+)%1",function(a,b)if 0<#b:gsub(a,"")then o(1)end end)o(0)

Ungolfed
Be care, there's two magic-variables called ..., the first one contains the argument of the program, the second one is local to the anonymous function and contains its parameters
o=os.exit;               -- ; mandatory, else it would exit instantly
(...):gsub("(.)(.+)%1",  -- iterate over each group of the form x.*x and apply an anonymous
  function(a,b)          -- function that takes the captured group as parameters
  if 0<#b:gsub(a,"")     -- if the captured group (.+) contain other character than
  then                   -- the one captured by (.)
    o(1)                 -- exit with falsy
  end
end)
o(0)                     -- exit with truthy, reached only when the string is okay

If it is permitted, you can replace os.exit() with i=#0...

Factor, 22 bytes
[ dup natural-sort = ]

Does what it says on the tin. As an anonymouse function, you should call this, or make it a : word ;.

it scares me when a cat brings a mouse into the game

@downrep_nation :P

Wolfram Language (Mathematica), 18 bytes
Gather@#==Split@#&

Try it online!
Gather gathers a list into sublists of identical elements, and Split splits a list into sublists of consecutive identical elements. They give the same result if and only if each value appears in only one contiguous block.

BQN, 9 5 bytes
≡⟜∧⊐˜

Anonymous tacit function. Takes a string or a list of integers. Try it at BQN online!
Explanation
Inspired by Dennis's J answer, though the details are a bit different.
Given two lists, ⊐ works as follows: for each element of its right argument, it finds the first index of that value in its left argument.
We're using ⊐˜, which passes the same list as both left and right arguments. The result is a list, for each digit, of the index of that digit's first occurrence.
If the digits are grouped together, these indices will occur in ascending order. However, if some copies of digit A are separated by digit B, B's (larger) index will come between the copies of A's (smaller) index.
≡⟜∧⊐˜
    ⊐˜  First index of each digit in the argument list
≡⟜      The result is identical to
   ∧     The result, sorted ascending

Jelly, 5 bytes
iⱮ`ṢƑ

Takes a list of integers. Try it online!
Explanation
Port of my BQN solution.
iⱮ`ṢƑ
i      First index of right argument in left argument
 Ɱ     mapped over right argument
  `    using the single argument as both left and right arguments
    Ƒ  The result is equal to
   Ṣ   itself sorted

Here's some other 5-byte solutions (see also Dennis's 5-byte solution):
ĠṢFṢƑ
Ġ      Group indices by their value in the list
 Ṣ     Sort list of lists of indices
  F    Flatten
    Ƒ  The result is equal to
   Ṣ   itself sorted

Try it online!
ĠṢF⁼J
Ġ      Group indices by their value in the list
 Ṣ     Sort list of lists of indices
  F    Flatten
   ⁼   The result is equal to
    J  Range from 1 up to len of original argument

Try it online!
¹ƙ`F⁼
¹ƙ`    Sort into buckets of identical items, ordered by first occurrence
   F   Flatten
    ⁼  The result is equal to the original list

Try it online!

An incredibly sad variation of the last one

Arturo, 28 bytes
$=>[=squeeze<=sort squeeze&]

Try it!
$=>[          ; a function where input is assigned to &
    squeeze&  ; squeeze the input; e.g. [1 1 2 1 1 1 3 3] -> [1 2 1 3]
    sort      ; sort
    <=        ; duplicate
    squeeze   ; squeeze
    =         ; are they equal?
]             ; end function

Thunno 2, 4 bytes
ñdḞ⁼

Try it online!
Input as a digit list.
Thunno 2, 5 bytes
çµUUạ

Try it online!
Input as an integer.
Explanation
ñdḞ⁼  # Implicit input
ñd    # Group identical items together
  Ḟ   # Flatten the list
   ⁼  # Equals the input?

çµUUạ  # Implicit input
ç      # Pair apply on the input:
 µU    #  Connected uniquify
   U   #  Uniquify
    ạ  # Are they the same?
       # Implicit output

Uiua, 6 bytes
≍⊝.⊜⊢.

Try it!
≍⊝.⊜⊢.
   ⊜⊢.  # get the first digit in each like contiguous group
  .     # duplicate
 ⊝      # deduplicate
≍       # do they match?

Ly, 22 bytes
&i[s=[ppl=]pl~[!u;]p]1

Try it online!
This one isn't that all short, but as far as I can tell it works differently from the other programs posted.  It deletes all "grouped" digits, then searches the remaining digits for the digit it just deleted.  If if finds another one, 0 is printed and the code exits.  If the stack is exhausted, the default 1 output is printed.
&i                     - read all the digits as codepoints
  [                 ]  - loop until the stack is empty
   s                   - save current digit
    =                  - is the next digit the same?
     [    ]            - yes, then loop deleting that digit
      p                - delete previous test results
       p               - delete digit we just checked
        l              - load the current digit
         =             - does the next one match?
           p           - delete loop/iterator var
            l          - load the current digit again
             ~         - is there another of those digits?
              [    ]   - yes, then time to exit...
               !ul;    - push "0", print and exit
                    p  - print test result variable
                     1 - push "1" for truthy result
                       - stack prints on exit

TI-BASIC, 24 22 bytes
Prompt A
sum(not(∆List(ʟA
SortA(ʟA
Ans=sum(not(∆List(ʟA

Takes input as a list ot integers.
-2 bytes thanks to MarcMush.

-2 bytes with not( instead of 0≠

@MarcMush I believe not( is equivalent to 0=. 0≠ is equivalent to not(not(.

The number will not be the same but you compare both of them so it works out in the end

If you change it at both lines

GNU sed -E,  32  28 bytes
Thank you, Jiří, for golfing off four bytes!
In the first line, remove all duplicate characters to avoid false positives, then check whether there is still a character twice. Output F for Falsy or T for Truthy:
s/(.)\1*/\1/g
/(.).+\1/cF
cT

Try it online!
Even without -E, it would only be 32 bytes, by far better than the current sed solution.

Nice! You can have it even in 28B by removing trailing space on the second line and the //!.

@Jiří Thank you. I wasn't really aware of how c works.

JavaScript ES6, 71 69 bytes
h=y=>y.match(/(.)\1*/g);x=>h((u=h(x)).sort().join``).length==u.length

Or, equivalently:
x=>((u=x.match(r=/(.)\1*/g)).sort().join``).match(r).length==u.length
x=>(h=y=>y.match(/(.)\1*/g))((u=h(x)).sort().join``).length==u.length

Golfing in progress.
Verify test cases

var truthy = `3
51
44999911
123456789
222222222222222222222`.split `
`;
var falsey = `818
8884443334
4545
554553
1234567891`.split `
`;

var Q = x => ((u = x.match(r = /(.)\1*/g)).sort().join ``).match(r).length == u.length;
truthy.concat(falsey).forEach(e => {
  t = document.createTextNode(`${e} => ${Q(e)}`);
  o.appendChild(t);
  o.appendChild(document.createElement("br"));
});
* {
  font-family: Consolas, monospace;
}

Perl 5, 20 bytes
19, plus 1 for -pe instead of -e.
$_=!/(.)(?!\1).+\1/

C, 74 73 71 bytes
Shaved one three byte thanks to @xsot!
a[99],c,m;main(d){for(;~c;m|=c^d&&a[d=c]++)c=getchar();putchar(48+!m);}

a[99] I love Perl's autovivification! Oh, wait...

I think this works: a[99],c,m;main(d){for(;~c;m|=a[d=c]+=c!=d)c=getchar();putchar(48+1/m);}

@xsot - Thank you for shaving one byte by replacing !--m with 1/m. About a[d=c]+=c!=d, I tried it with gcc and it didn't work on my computer because of order of evaluation. We must find a compiler that will play along.

Oh, I just tested it on ideone and it worked fine. How about this: a[99],c,m;main(d){for(;~c;m|=c^d&&a[d=c]++)c=getchar();putchar(48+!m);}

-2 bytes using read(2) and outputting 49 - m: a[99],c,m;main(d){for(;read(0,&c,1);m|=c^d&&a[d=c]++);putchar(49-m);}, also possible is return m to save an extra 5 bytes

C# 111 bytes
bool f(string s){for(int i=0;i<s.Length-1;i++)if(s[i]!=s[i+1]&&s.LastIndexOf(s[i])!=i)return 1==2;return true;}

old strategy 131 bytes
bool s(string i){var f=Regex.Matches(i,@"([0-9])\1{0,}").Cast<Match>().Select(m=>m.Value[0]);return f.Distinct().SequenceEqual(f);}

first golf i think i did ok in

Racket, 53 bytes
The dumb, simple version.
(λ(s)(let([s(string->list s)])(eq?(sort s char<?)s)))

Ungolfed:
(define (lame-all-together s)
  (let ([s (string->list s)])
    (eq? (sort s char<?) s)))

Racket, 86 bytes
Here's the version implementing @xnor's comment about more efficient ways to do this.
(λ(s)(let([s(string->list(regexp-replace#px"(.)\\1+"s"\\1"))])(eq?(sort s char<?)s)))

Ungolfed:
(define (all-together s)
    (let ([s (string->list (regexp-replace #px"(.)\\1+" s "\\1"))])
      (eq? (sort s char<?) s )))

Okay, this may actually just shift the weight of computation from the sort function to regexp-replace, but it was an interesting solution. Basically, it removes runs of duplicate characters first (see here), then tests if the remaining length-1 runs are in sorted fashion.

Desmos, 83 bytes
A=[1...l.length][l=i]
L=join(A.min-1,A)
f(l)=[0^{max(L[2...]-L-1)}fori=l[1...]].min

Try It Online!
Try It Online! - Prettified

sed, 54 bytes
:a
/^1/{s/1*//;/1/cF
}
y/123456789/912345678/
/./ba
cT
Attempt This Online!

Clever idea, but no match for back references!

Ruby, 30 bytes
->s{(s*'').squeeze==s.uniq*''}

Try it online!
Longer than using regex, but uses a builtin that doesn't need to exist.
squeeze is connected-uniquify. It's on strings, but not lists, and uniq is on lists, and not strings...

Convex, 17 bytes
9´\f{\s'++\ð½¬}ª!

Try it online!

Japt, 9 bytes
ò¦ mÌ
eUâ

Try it

Explanation
          :Implicit input of string U             :e.g., "8884443334"
ò¦        :Split on inequality                    :["888","444","333","4"]
   mÌ     :Map and return the last digit of each  :["8","4","3","4"]
\n        :Assign to U
  Uâ      :Remove duplicates                      :["8","4","3"]
e         :Test for equality with U               :false
          :Implicit output of result

APL (Dyalog), 17 bytes
(⍋≡⍳∘≢)∘⌽∘∊2⊥∘.=⍨

Try it online!

Oracle SQL, 158 bytes
select decode(count(*),count(unique y),1,0)from(select regexp_substr(x,'(.)\1*',1,level,'',1)y from t connect by regexp_substr(x,'(.)\1*',1,level)is not null)

It works with an assumption that input data is stored in a table t(x), e.g.
with t(x) as (select '44999911' from dual)

brev, 86 bytes
(fn(with(call-table)((as-list(c every(fn(or(eq?(it'l)x)(it x(not(it(it'l x))))))))x)))

or 79 if it doesn't have to reset its memory between each call, i.e. doesn't have to be idempotent:
(with(call-table)(as-list(c every(fn(or(eq?(it'l)x)(it x(not(it(it'l x)))))))))

People are submitting solutions that take lists of integers. That'd shave 9 bytes off of mine (the (as-list …)).

Scala 3, 58 bytes
A port of @JamesENL's Java answer in Scala.

Golfed version. Attempt This Online!
x=> !new Regex("(.)(?!\\1).*\\1").findFirstIn(x).isDefined

Ungolfed version. Attempt This Online!
import scala.util.matching.Regex

object Main {
  def main(args: Array[String]): Unit = {
    val pattern = new Regex("(.)(?!\\1).*\\1")

    val testCases = List(
      ("3", true),
      ("51", true),
      ("44999911", true),
      ("123456789", true),
      ("222222222222222222222", true),
      ("818", false),
      ("8884443334", false),
      ("4545", false),
      ("554553", false),
      ("1234567891", false)
    )

    testCases.foreach { case (input, expected) =>
      val result = !pattern.findFirstIn(input).isDefined
      assert(result == expected, s"Test case '$input' failed, expected $expected but got $result")
      println(s"Test case '$input' passed")
    }
  }
}

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Convert phrases to reverse style
The Challenge
Convert a phrase of two words to reverse style: candy bar -> bar le candy.
Specifications

There will be one word (only a-zA-Z0-9 + -), a space (), and then another word.
For equal length, score is used to determine winner.

Test cases:
candy bar -> bar le candy
code golf -> golf le code
programming puzzles -> puzzles le programming

Seems a bit too simple.

@orlp I want to see how short it can be  in long languages, like Java or languages with bad string parsing.

I haven't studied French for over 30 years, but surely the le belongs before the noun, not after?

@Neil This isn't supposed to be actual French. It is just reversing the adjective and noun, with a 'le' in between.

surely it would be (LE) bar DE candy for it to bear any resemblance to actual french. I find the idea that this resembles french to be quite grating.

@LevelRiverSt It is 'French style' not 'French'. It is just reversing the adjective and noun, with a 'le' in between.

Next-o you-o will-o be telling-o me-o that this is Spanish-o style. It's not French style. It's the style of a meme written by someone who knows nothing about French. If you put bar DE candy it would at least have some degree of authenticity.

Downvoting because of how trivial it is.

@Downgoat Have you downvoted "Hello, World"?

@NoOneIsHere Hello, World! has a different purpose, it's a pretty good reference of codegolfed source about one of the most common exercise there is. Also, if you really want to point out to this challenge, look at how the specs are specified for something so trivial, it is actually a question of great quality.

Everybody arguing about French, chat here.

The specification talks about adjectives, but there isn't a single adjective in any of the test cases. What on Earth is the challenge?

@PeterTaylor convert a two word phrase (e.g. code golf) into it'sself reversed, with a ' le ' inbetween (so code golf -> golf le code).

To Closevoters: How is this unclear? It's trivial, sure, but that's not what close votes are for. That's what downvotes are for.

@DrGreenEggsandHamDJ I agree, I think the example is perfectly clear. The close votes started around the time of Peter's comment, and I think they are about the fact that this has very little to do with real french (though the title claims it does.) Technically Peter is right, the first word in the examples are not adjectives. But they are nouns functioning as adjectives.

@cat wizzwizz4 added an edit to the queue and I accepted it.

@NoOneIsHere Better! :D

I VTR'd because this is sufficiently different than the newer question.

CJam, 9 bytes
rr" le "@

Try it online!
Pushes first 2 tokens and then the " le " literal to stack, and then rotates the stack, moving the first word to the end of the stack. Output of the resulting stack is implied.

Alternatively, " le "rro.

Too bad CJam doesn't do implicit input as well.

Reng v.3.3, 55 bytes
Try it here!
1#zaií1ø
):Weq!vz1+#z
br[zÀz/]; !o
le"Wro/ !ob"
    ~;/

I can probably golf it by taking input until a space is found, as this approach takes all input at once.
Explanation
Input & init
1#zaií1ø

1#z stores 1 to z. a is a one-sided mirror from the left side, meaning you can pass through it from left-to-right, but not otherwise. i takes a char of input, and í mirrors iff there is input on the input stack. Otherwise, it proceeds. 1ø goes to the next line.
Print first word
):Weq!vz1+#z

) rotates the stack left one, : duplicates it, We checks for the equality with a space, and !v goes down iff it is a space and goes to the next phase. z1+#z increments z otherwise.
(more to come)

Here's a GIF:

Vim  9 keystrokes
dwA le <esc>p

I'm so close to beating pyth and Cjam! Unfortunately, I can't figure out how to take any more off, so I'll have to be satisfied with tying. =)
Explanation:
dw             'Delete a word
  A le <esc>   'Enter " le " at the end of the current line
            p  'Paste the previously deleted text

Pyth - 9 bytes
j" le "_c

Test Suite.

Ninja'd me and I didn't know you could have implicit z?

@orlp its implicit Q, i'm taking input in quotes.

This kinda looks like french, "j'le _c" :P

MATL, 12 bytes
Yb'le'h7L)Zc

Try it online!
Yb       % Take input implicitly. Split by spaces. Gives a cell array
'le'     % Push this string
h        % Concatenate horizontally into cell array
7L       % Push [2 3 1]
)        % Apply as index, to change order
Zc       % Join with spaces. Gives a string. Display implicitly

Wait... How does 7L -> [2 3 1] ?

@Cyoce It's the default content of level 7 of clipboard L. You can see them all here, table 2, pae 15

Python 3, 41 bytes
print(' le '.join(input().split()[::-1]))

Good first golf! Welcome to the site!

@DrGreenEggsandHamDJ thanks! I wasn't sure if it was appropriate because it's so similar to the other two Python answers, but this game seems really fun.

Welcome to Programming Puzzles & Code Golf! Unfortunately, this will only produce output inside a REPL. By default, we require functions or full programs, which use these methods for I/O.

@Dennis, darn well I'll update, but it's gonna cost me. Thanks!

R, 30 bytes
cat(rev(scan(,"")),sep=" le ")

This is a full program that accepts reads a string from STDIN and prints to STDOUT. The scan function implicitly separates space-delimited input into elements of an array. We then just reverse the array and print it, using le as a separator between elements in the output.

GS2, 9 bytes
, ♦ le ♣2

Try it online!

Looks like 9 is the magic number for this challenge.

IPOS, 13 bytes
rS!r%S" le "R

Could < 10 bytes if I had implemented all the builtins that I have planned...
Explanation

r         # Reverse the input
S!r%      # Reverse every word -> Word order is now swapped
S" le "R  # insert a " le " between the two words by replacing the space

Non-competing 9-byte version
This only works with the version I pushed just now (implemented C).
SC"le"@Sj

This works by splitting the input on spaces to obtain the two words (SC), pushing the literal le, rotating the stack (@) so the words are swapped and the le is between them and finally joining the stack on spaces (SJ).
Again, could be shorter since I also plan to add commands for joining and splitting on spaces which would make this 7 bytes. But since those are probably gonna be non-ASCII characters and I haven't fully figured out the codepage I am gonna use, those have to wait a bit.

JavaScript (ES6), 34 32 bytes
s=>(a=s.split` `)[1]+" le "+a[0]

Saved 2 bytes thanks to @jrich!

s=>(a=s.split` `)[1]+" le "+a[0]

Wow, just now, I independently came up with this.

Jelly, 9 bytes
ṣ⁶Ṛj“ le

Try it online!

><>, 35 bytes
i:" "=?v
ov?(0:i<
"\~~r" el
o>l?!;

The first line reads a character of the first word and put it on the stack, then goes to the second line if it encounters " " or otherwise loops.
The second line reads a character of the second word and prints it right away, then goes to the third line when if encounters EOF or otherwise loops.
The third line removes the space and the EOF from the stack, reverts it and pushes " le " backward, then goes to the fourth line.
The fourth line stops execution if the stack is empty, otherwise it prints a character of the stack (poping it) and loops.

Pyke, 10 bytes
dcX"le"RdJ

Try it here!
Or 9 bytes (noncompeting, add insert)
Dd@" le":

Try it here!

Shouldn't it be "le" ?

Python, 37 bytes
lambda s:" le ".join(s.split()[::-1])

Won't this give code golf -> code le golf?

@NoOneIsHere Misunderstood the problem, fixed now.

Python 2, 34 bytes
a,b=input().split();print b,"le",a

Expects input in quotes.
>> "code golf"
golf le code

Jolf, 10 bytes
Try it here!
R_pti" le
  pti      input split by spaces
 _         reversed
R    " le  joined by that string

BATCH file, 14 bytes
@ECHO %2 le %1

Save to a file and invoke as notFrench word1 word2.
C:\Users\Conor O'Brien\Documents\Programming\PPCG>notFrench code golf
golf le code

C:\Users\Conor O'Brien\Documents\Programming\PPCG>

I'm not sure if that's allowed. You're basically making the shell split the string for you.

@Dennis I see. Gimme a moment to revise.

Can't you use echo instead of @ECHO?

@NoOneIsHere Nope, this well also output the command.

Go, 81 bytes
import."strings"
func f(s string)string{h:=Split(s," ")
return h[1]+" le "+h[0]}

Perl, 18 bytes
/ /;$_="$' le $`"

This program is 17 bytes long and requires the -p switch (+1 byte).

Lua, 46 Bytes
a=(...):gsub("(%w+) (%w+)","%2 le %1")print(a)

I save the result of gsub to a variable because it returns 2 values, and would therefore print a 1 which is the number of changes made to the string. The other work around is about disallowing gsub's return to unpack. Also, it is actually longer by 1 byte:
print((...):gsub("(%w+) (%w+)","%2 le %1")..'')

Retina, 14 bytes
Byte count assumes ISO 8859-1 encoding.
M!r`\S+
¶
 le

Try it online! (Slightly modified to process all test cases at once.)
The first stage reverses the two words and separates them by a linefeed (this is done by matching them with right-to-left mode and printing all matches).
The second stage replaces the linefeed (¶) with  le .

Do you need the...! should imply match mode. (And plus who uses Match without ! except at the end anyway?)

@CatsAreFluffy You're right, a lot of options are currently exclusive to certain stage types, so they could imply the stage type, but I think I'd rather leave the option of reusing the characters for different options in different modes at some point. As for defaulting to ! before the final stage, that might be worth thinking about...

Do it! But be careful, as M without ! does occur, but not very often (see the number groups challenge)

Mathematica, 30 bytes
#2<>" le "<>#&@@StringSplit@#&

Not very complicated...

Seriously, 13 bytes
"le"' ,so/' j

Try it online
Explanation:
"le"' ,so/' j
    ' ,s       split input on space
"le"    o/     stick "le" between words
          ' j  join on space

Gawk, 17 16 bytes
1 byte off thanks to muru
{$0=$2" le "$1}1

Old
{print$2" le "$1}

Java 8, 41 39 bytes
A simple lambda, for a simple challenge
s->s.replaceAll("(.+) (.+)","$2 le $1")

Update

-3 [17-02-23] Thanks to @Kevin

This is shorter though: s->s.replaceAll("(.+) (.+)","$2 le $1") (39 bytes) :)

Japt, 9 8 bytes
Note the trailing space.
¸w q` ¤

Saved a byte thanks to a reminder from obarakon.

Try it online

Explanation
        :Implicit input of string U
¸       :Split to array on space
w       :Reverse
q.      :Join to string...
` ¤     : with the compressed string " le "

Don't forget about string compression ;)

Oh, yeah; really gotta do better at remembering that! Ta, @obarakon

C# - 43 bytes
string.Join(" le ",x.Split(' ').Reverse());

This is not a program or function; this is a snippet. However, you can add x=> to the beginning to make it a lambda function.

Ruby, 24 bytes
->s{s=~/ /;"#$' le #$`"}

Try it online!

PHP, 47 Bytes
<?=preg_filter("#(.+) (.+)#","$2 le $1",$argn);

Try it online!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Concatenating Primes
Challenge:
You are given a string containing only digits. Your task is to output the minimum number of primes which must be concatenated to form the string. If this is impossible, output 0.
Test Cases:
Input -> Output:
252 -> 3
235 -> 2
92 -> 0
31149 -> 2

Related

Can there be leading zeroes?

Yes, there can be leading zeroes.

Can we take a list of digits?

What happens if there are leading zeroes?

Format of input/output?

JavaScript (ES6), 123 121 120 bytes
f=(s,v)=>(p=n=>--n-1?s%n&&p(n):1)(s)||[...s].map((_,i)=>!(n=i&&(a=f(s.slice(0,i)))&&(b=f(s.slice(i)))&&a+b)|n>v?0:v=n)|v

Saved a byte thanks to @Neil!
Explanation
Takes a single string as input. Due to the prime checking method (recursive trial division), the greatest number that can be safely checked is 13840. Some numbers above this will fail due to the maximum call stack size being exceeded. It does, however, finish instantly for every case it can handle.

f=(s,v)=>
  (p=n=>--n-1?s%n&&p(n):1)(s) // if s is prime, return 1
  ||[...s].map((_,i)=>        // else for each index in s, split s into 2
    !(n=i&&                   // v = return value (initialised to undefined)
      (a=f(s.slice(0,i)))&&
      (b=f(s.slice(i)))&&
      a+b
    )|n>v?0:v=n               // if i, a, b and n are all > 0 and !(n > v), v = n
  )|v                         // cast v to an integer and return it

// Test
var testCases = [ "252", "235", "92", "3149", "24747" ];
document.write("<pre>" + testCases.map(c => c + ": " + f(c)).join("\n"));

Is it me or can you change i?(a=...)&&(b=...)&&a+b:0 to i&&(a=...)&&(b=...)&&a+b?

MATL, 26 24 bytes
0in:"GUtZq@Z^V10ZA=a?x@.

It takes a few seconds for some of the test cases.
Try it online!
Explanation
0       % Push 0
in:     % Take input. Generate array [1,2,...,N] where N is input length
"       % For each. In each iteration the number of used primes is increased
  GU    %   Push input. Convert to number
  tZq   %   Duplicate. Array of primes smaller than the input
  @     %   Push number of primes to bes tested in this iteration
  Z^    %   Cartesian power
  V     %   Convert to 2D array. Each row is a combination of primes
  10ZA  %   Convert each row to base 10, disregarding spaces
  =a    %   Do any of the results equal the input number?
  ?     %   If so
    x   %     Remove the 0 that's at the bottom of the stack
    .   %     Break for each loop
        %   Implicitly end if
        % Implicitly end for each
        % Implicitly display

Pyth - 19 17 16 bytes
lhf.AmP_sdTa./zY

Test Suite.

In its newer form, this one counts 0 and 1 as primes.  However, before the edit, it did not.

@poi830 fixed it.

Pyth, 16 bytes
lhaf!f!P_sYT./zY

Test suite
Explanation to follow.

Bash + coreutils, 169 158 149 bytes
c()
{
test $1||echo a
for i in `seq ${#1}`
do factor ${1::$i}|grep -q ': \w*$'&&printf b%s\\n `c ${1:$i}`
done
}
c $1|sort|sed '/a/!d;s/..//;q'|wc -c

We count in unary, outputting a line with one b for each prime and a terminating a at the end of line (so that printf has a token to work with).
The primality test is factor $n | grep -q ': \w*$', which determines whether the number has exactly one prime factor.
We recursively partition the input; if the left half is prime, we filter the results of the right half by adding one to each value.  Returning a for a zero-length input terminates the recursion.
Finally, we take all the results and sort to find the shortest (ignoring any that don't have the a to indicate success); we must delete two (for the inserted a and for the newline), then count characters to give the result.
Tests
$ for i in 252 235 92 31149 111; do echo "$i:"$'\t'"$(./77623.sh $i)"; done
252:    3
235:    2
92:     0
31149:  2
111:    0

I added 111 to the tests to show that 1 is correctly considered non-prime.

I was going to suggest this. Most of my modifications are probably obsolete now, but others should still work.

@Dennis - I like the c to generate the final 0.  Not so keen on the copious stderr, though.  You're welcome to use (versions of) my answer as a basis for your own if you like.

Mathematica, 142 135 bytes
Min[Length/@Select[Join@@@Permutations/@IntegerPartitions@Length[a=#],And@@PrimeQ@*FromDigits/@a~Internal`PartitionRagged~#&]]/.∞->0&

As you can see, Mathematica was not built for this task. Takes a list of digits.

Can you use And@@ instead of AllTrue? Should save 4-5 bytes.

Flatten[#,1]=Join@@@#

Um...gives error and wrong answer on 133...you did use all test cases, right?

@CatsAreFluffy Golfed and clarified.

Stax, 18 bytes
¬∞ÿ╔>÷▀↓☼~î☼ó♀RàEx

Run and debug it


text:
420 <s>Blaze</s> Golf It
This is a pretty simple challenge, but (I hope) a fun one.
Task
If right now either the month is 4 and the day is 20, the hour (on a 12 hour clock) is 4 and the minute is 20, or the minute is 4 and the second is 20, print this ascii art:
                        .
                       .:.
                       :|:
                      .:|:.
                      ::|::
       :.             ::|::             .:
       :|:.          .::|::.          .:|:
       ::|:.         :::|:::         .:|:;
       `::|:.        :::|:::        .:|::'
        ::|::.       :::|:::       .::|:;
        `::|::.      :::|:::      .::|::'
         :::|::.     :::|:::     .::|::;
         `:::|::.    :::|:::    .::|::;'
`::.      `:::|::.   :::|:::   .::|::;'     .:;'
 `:::..    `;::|::.  :::|:::  .::|:::    ::::;
   `:::::.    ':|::. :::|::: .::|:'   ,::::;'
     `:::::.    ':|:::::|:::::|:'   :::::;'
       `:::::.:::::|::::|::::|::::.,:::;'
          ':::::::::|:::|:::|:::::::;:'
             ':::::::|::|::|:::::::''
                  `::::::::::;'
                 .:;'' ::: ``::.
                      :':':
                        ;

You can have trailing spaces.
Otherwise, print the number of minutes and seconds left until the next such occasion in the format: %d minutes and %d seconds left until your next hit. with the time being minimized.
This is code-golf, so shortest code in bytes wins!
P.S. If this challenge is too inappropriate for this site, tell me and I'll change it.

Aren't you, like, in the first half of high school? :P

Also, does 4:00 PM (on an otherwise nonprint-y time) count as print-y because of the 4 or nonprint-y because it's also 16:00 hours?

I'd be more worried about it being a dupe, I feel like two halves of old challenges (the various timing ones and the various kgc ones) doesn't really make this a very interesting challenge, but I'm not really sure what I would close it as a dupe of (or if it's even correct to do that...).

@ANerd-I printy, I'll edit that in.

I was looking at this image and wondering if some sort of custom run-length encoding would be viable for golfing the output, or if there's a better solution?

Including \n .:;'`| that's 8 characters so the RLE would only need 3 bits to represent each character.

There seems to be a mistake on one line, where the central | does not line up with the centreline of the leaf. Correcting it by removing 4 . from the left and adding 4 spaces on the right I get [   \:::::.    ':|::. :::|::: .::|:'   ,::::;'] Is this apparent error intentional? (backtick replaced by backslash)

@LevelRiverSt I honestly have no clue, I got this leaf from online. Do you want to edit it?

As there are no answers yet, I've gone ahead and edited. It makes it more symmetrical (though not perfectly symmetrical) which should be easier to golf.

@LevelRiverSt cool thanks.

Python 2, 371 bytes
This source contains non-printable bytes, so it is presented as a hexdump that can be decoded with xxd -r.
00000000: efbb bf66 726f 6d20 7469 6d65 2069 6d70  ...from time imp
00000010: 6f72 742a 0a74 3d74 696d 6528 290a 693d  ort*.t=time().i=
00000020: 300a 7768 696c 6527 3034 3a32 3027 6e6f  0.while'04:20'no
00000030: 7420 696e 2073 7472 6674 696d 6528 2725  t in strftime('%
00000040: 6d3a 2564 2572 272c 6c6f 6361 6c74 696d  m:%d%r',localtim
00000050: 6528 742b 6929 293a 692b 3d31 0a70 7269  e(t+i)):i+=1.pri
00000060: 6e74 5b22 7801 74cd c701 c430 0844 d1bb  nt["x.t....0.D..
00000070: aaf0 cd99 0286 6654 887a dfa0 f41d 7136  ......fT.z....q6
00000080: 8f61 7829 0b6f 5c72 bdb6 9414 de86 d2eb  .ax).o\r........
00000090: 9894 d4e7 64f7 de39 099a 8ed8 32b5 d34a  ....d..9....2..J
000000a0: e8c9 2a53 9da4 371a b1d0 a3d4 18e8 b212  ..*S..7.........
000000b0: 5a25 a139 158a ac90 4cba 7692 4007 c62e  Z%.9....L.v.@...
000000c0: 81b8 31c4 9682 04e2 6ab8 8f21 3bb3 3ce1  ..1.....j..!;.<.
000000d0: 7582 0163 8524 79a8 c175 cb58 7ce5 45ff  u..c.$y..u.X|.E.
000000e0: b3b7 8cc7 bfbe fbaa 9b95 b068 1837 db90  ...........h.7..
000000f0: a546 b54a 5cb9 5c38 6801 0936 a2a8 a85e  .F.J\.\8h..6...^
00000100: 6ca3 4c3e 8e83 a4ef 1412 12ac 7027 7075  l.L>........p'pu
00000110: 2084 ca61 026b 5c30 286e a1fe 222e 6465   ..a.k\0(n..".de
00000120: 636f 6465 2827 7a69 7027 292c 2725 6420  code('zip'),'%d
00000130: 6d69 6e75 7465 7320 616e 6420 2564 2073  minutes and %d s
00000140: 6563 6f6e 6473 206c 6566 7420 756e 7469  econds left unti
00000150: 6c20 796f 7572 206e 6578 7420 6869 742e  l your next hit.
00000160: 2725 2869 2f36 302c 6925 3630 295d 5b69  '%(i/60,i%60)][i
00000170: 3e30 5d                                  >0]

Readable part:
from time import*
t=time()
i=0
while'04:20'not in strftime('%m:%d%r',localtime(t+i)):i+=1
print["(ZLIB DATA)".decode('zip'),'%d minutes and %d seconds left until your next hit.'%(i/60,i%60)][i>0]

Oh whoops, I misread the code. I thought it continually looped and printed. Stupid tiny mobile screen.

JavaScript (ES6), 537 bytes

alert((f=t=>new Date(Date.now()+t*1e3).toISOString().match`(T16|04)[-:]20`)(i=0)?"À\u0019\u0002û1!°?4\u0002ë14!°>C3\u0002=\u0001Ê34\u0003Ê1\u0002=4\u00011C3\u000114\u0002=C\u0013ð4\u0009\u001fCS\u0002m34\u0001>Ià14s\u0002>C3\u0001=IÐ1CS\u0002n34\u0013À4\u0009\u001c34s\u0002?I3\u0001;I°1C3%ð6I3\u0001:I 1C3ub3\u0001l4\u00134\u0009\u001934S\u0007\u001bS'`\u0011 V34\u0013\u00004\u0009\u001034\u0009:Z\u0002i³\u0001zC3\u00014\u00091Cs8Z'°6\u001b 74K³4\u00079['Ð6\u001b³4J£4\u001a8Y' yó4I4]s\u0002Ê7M34CÓw\u0002«6u\u00021u\u0007`6\u0013\u0002ëss#ÀY".replace(/./g,c=>(l=" .\n:|;`',0123456")[(n=c.charCodeAt())&15]+l[n>>4]).replace(/.\d+/g,c=>c[0].repeat(parseInt(c.slice(1),7)+3)):eval('for(;!f(++i););`${i/60|0} minutes and ${i%60|0} seconds left until your next hit.`'))

Uses the CP-1252 encoding.
Note: All unreadables in this post are escaped with \u00xx so that the Stack Exchange system doesn't automatically remove them. They should be considered to have a size of one byte.
Explanation
Uses a run-length encoding scheme along with packing each character into 4 bits. The main logic of the code is 174 bytes and the leaf string (including decompression) is 364 bytes. Further details of the compression method are found below.
alert((
  f=t=>                                   // f checks for 4:20 in a date
    new Date(Date.now()+t*1e3)            // get the date at now + t seconds
    .toISOString().match`(T16|04)[-:]20`  // find 4:20 in the ISO date string
)(i=0)?

  // Leaf decompression
  "À\u0019\u0002û1!°?4\u0002ë14!°>C3\u0002=\u0001Ê34\u0003Ê1\u0002=4\u00011C3\u000114\u0002=C\u0013ð4\u0009\u001fCS\u0002m34\u0001>Ià14s\u0002>C3\u0001=IÐ1CS\u0002n34\u0013À4\u0009\u001c34s\u0002?I3\u0001;I°1C3%ð6I3\u0001:I 1C3ub3\u0001l4\u00134\u0009\u001934S\u0007\u001bS'`\u0011 V34\u0013\u00004\u0009\u001034\u0009:Z\u0002i³\u0001zC3\u00014\u00091Cs8Z'°6\u001b 74K³4\u00079['Ð6\u001b³4J£4\u001a8Y' yó4I4]s\u0002Ê7M34CÓw\u0002«6u\u00021u\u0007`6\u0013\u0002ëss#ÀY"
  .replace(/./g,c=>                       // unpack each 4-bit character
    (l=" .\n:|;`',0123456")               // l = lookup table of characters
    [(n=c.charCodeAt())&15]+l[n>>4]       // return the two characters in the byte
  )
  .replace(/.\d+/g,c=>                    // run-length decoding
    c[0].repeat(parseInt(c.slice(1),7)+3) // repeat character n + 3 times (base-7)
  )

:eval(`                                   // eval just to allow a for loop here...
  for(;!f(++i););                         // check each second up until a match

  \`${i/60|0} minutes and ${i%60|0} seconds left until your next hit.\`
`))

Compression Algorithms
No Compression, 911 bytes
This is the leaf string with no compression at all.
`                        .
                       .:.
                       :|:
                      .:|:.
                      ::|::
       :.             ::|::             .:
       :|:.          .::|::.          .:|:
       ::|:.         :::|:::         .:|:;
       \`::|:.        :::|:::        .:|::'
        ::|::.       :::|:::       .::|:;
        \`::|::.      :::|:::      .::|::'
         :::|::.     :::|:::     .::|::;
         \`:::|::.    :::|:::    .::|::;'
\`::.      \`:::|::.   :::|:::   .::|::;'     .:;'
 \`:::..    \`;::|::.  :::|:::  .::|:::    ::::;
   \`:::::.    ':|::. :::|::: .::|:'   ,::::;'
     \`:::::.    ':|:::::|:::::|:'   :::::;'
       \`:::::.:::::|::::|::::|::::.,:::;'
          ':::::::::|:::|:::|:::::::;:'
             ':::::::|::|::|:::::::''
                  \`::::::::::;'
                 .:;'' ::: \`\`::.
                      :':':
                        ;`

Run-Length Encoding, 542 bytes
Since there are many consecutive repeated characters, run-length encoding improves the byte count significantly.
` 21.
 20.:.
 20:|:
 19.:|:.
 19::|::
 4:. 10::|:: 10.:
 4:|:. 7.::|::. 7.:|:
 4::|:. 6:0|:0 6.:|:;
 4\`::|:. 5:0|:0 5.:|::'
 5::|::. 4:0|:0 4.::|:;
 5\`::|::. 3:0|:0 3.::|::'
 6:0|::. 2:0|:0 2.::|::;
 6\`:0|::. 1:0|:0 1.::|::;'
\`::. 3\`:0|::. 0:0|:0 0.::|::;' 2.:;'
 \`:0.. 1\`;::|::.  :0|:0  .::|:0 1:1;
 0\`:2. 1':|::. :0|:0 .::|:' 0,:1;'
 2\`:2. 1':|:2|:2|:' 0:2;'
 4\`:2.:2|:1|:1|:1.,:0;'
 7':6|:0|:0|:4;:'
 10':4|::|::|:4''
 15\`:7;'
 14.:;'' :0 \`\`::.
 19:':':
 21;`.replace(/.\d+/g,c=>c[0].repeat(+c.slice(1)+3))

Each character repeated 3 or more times is replaced with the character followed by a decimal number of amount - 3. The encoded string is generated with this code:
uncompressed.replace(/(.)\1{2,}/g,c=>c[0]+(c.length-3))

4-bit Packing + RLE, 364 bytes
There are 9 distinct characters in the original string, which means 4 is the minimum number of bits to represent each. Conveniently, this allows for exactly two character representations to fit into a single byte, enabling a simple (and golf-friendly) decompression algorithm to be used. On top of that, there are 7 characters left over, which allows base-7 run-length encoding to be used before packing. Putting each 4-bit index into the upper and lower nibbles of each compressed character means 2 characters are stored per byte, because the CP-1252 encoding encodes every character under code point 256 as a single byte.
"À\u0019\u0002û1!°?4\u0002ë14!°>C3\u0002=\u0001Ê34\u0003Ê1\u0002=4\u00011C3\u000114\u0002=C\u0013ð4\u0009\u001fCS\u0002m34\u0001>Ià14s\u0002>C3\u0001=IÐ1CS\u0002n34\u0013À4\u0009\u001c34s\u0002?I3\u0001;I°1C3%ð6I3\u0001:I 1C3ub3\u0001l4\u00134\u0009\u001934S\u0007\u001bS'`\u0011 V34\u0013\u00004\u0009\u001034\u0009:Z\u0002i³\u0001zC3\u00014\u00091Cs8Z'°6\u001b 74K³4\u00079['Ð6\u001b³4J£4\u001a8Y' yó4I4]s\u0002Ê7M34CÓw\u0002«6u\u00021u\u0007`6\u0013\u0002ëss#ÀY"
.replace(/./g,c=>(l=" .\n:|;`',0123456")[(n=c.charCodeAt())&15]+l[n>>4])
.replace(/.\d+/g,c=>c[0].repeat(parseInt(c.slice(1),7)+3))

The following code is used to do the run-length encoding and packing:
chars="",max=16;
[...uncompressed].map(c=>~chars.indexOf(c)?0:chars+=c);
base=max-chars.length;
chars+=[...Array(base).keys()].join``;
unpacked=uncompressed.replace(/(.)\1{2,}/g,c=>c[0]+(c.length-3).toString(base));
packed=unpacked.replace(/(.|\n){2}/g,s=> // Note: unpacked length must be even!
  String.fromCharCode(chars.indexOf(s[0])|(chars.indexOf(s[1])<<4)));

Huffman Coding, (Possible Future Improvement)
Certain characters occur much more than others, so a Huffman encoding (variable-length integers representing each character) could save some further bytes. However this will introduce a lot more complexity into the decompression algorithm, so aside from being a lot more work it may also cost more bytes to decompress it than it saves in the encoded string.

I tried using the same compression as I did for my Easter answer but that takes 421 bytes just to reproduce the string.

Javascript ES6, 905 bytes
Whew.. The 12 hour clock killed my otherwise short (ahum) solution.
905 bytes to print 898 chars of ascii art yay
_=>(a=(d=Date)(c=new d(),z=O=>Math.abs(new d(a[3]+O)-c)).split` `)[1]=='Apr'&a[2]==20|~a[4].search(/(04|16):20/)?'0,0,2ca2o,0,10e,0,0,1eu9z4,0,22w,1ulajuo,0,bklxc,2zgg,i,120gdfk,8lc,1s1s,15,j0jf9c,7em8,tac,10,190zcw0,tm8w,ksk,hra0ia,mihog0,3aels,wy,iv8e15,b98u80,cvs1s,575,9fm71g,190zcw0,bg7vgg,1t4,148d4lu,121pblx,b9ea68,2b36,iv8hn5,9zleso,15kytz4,98cp,4fwpwk,zir9ud,1h9u3ln,11c6vb4,84kda8,kbuo05,b98u84,14possy,k9su6i,a26hwk,zvft34,kavrpc,1tn1j4,1r3jis,kamgao,a5bhq8,2b2q,beyt6x,j0y810,muhiww,9xl,a5b7s8,14npcwi,1bkfw1s,4ys,14lipw4,kalr6k,0,1aq,kalqzg,0,48m,2j6hqf,zik0zk,0,33mcjk,0,5'.split`,`.map(a=>('0'.repeat(32)+parseInt(a,36).toString(2)).substr(-32)).join``.match(/.{1,3}/g).map(a=>` .:\`|;'
`[parseInt(a,2)]).join``:~~((T=Math.min(z('/4/20'),z(` ${a[1]} ${++a[2]} 0:4:20`),z(' 4:20'),z(' 0:4:20'),z(' 16:20'),z(' 0:16:20'))/1000)/60)+` minutes and ${~~(T%60)} seconds left until your next hit.`

Ungolfed code
Note: The ungolfed code will not execute
function() {
    // (all vars here are actually global)
    var d = Date; // short reference to Date object
    var dateString = Date() // "Tue Apr 12 2016 20:13:00 GMT+0200 (W. Europe Daylight Time)"
    .split` `; // ["Tue", "Apr", "12", ...]
    var currentDate = new Date();
    dateDiff = function(toAppend) {
        return Math.abs( // no dates in the past
            new Date(dateString[3] + toAppend) // new Date('2016' + something)
            - currentDate // substract the current date.
                          // Thanks JS for the datetime implementation
        );
    }

    if ((dateString[1] == 'Apr' & dateString[2] == 20) |
        ~dateString[4].search(/(04|16):20/)) { // if the time doesn't contain 04:20 or
                                               // 16:20, this will return -1. ~-1 is 0
                                               // and thus falsy
        alert(printAscii());
    } else {
        alert(printTimeLeft());
    }
}

function printAscii() {
    var magicString = '0,0,2ca2o,0,10e,0,0,1eu9z4,0,22w,1ulajuo,0,bklxc,2zgg,i,120gdfk,8lc,1s1s,15,j0jf9c,7em8,tac,10,190zcw0,tm8w,ksk,hra0ia,mihog0,3aels,wy,iv8e15,b98u80,cvs1s,575,9fm71g,190zcw0,bg7vgg,1t4,148d4lu,121pblx,b9ea68,2b36,iv8hn5,9zleso,15kytz4,98cp,4fwpwk,zir9ud,1h9u3ln,11c6vb4,84kda8,kbuo05,b98u84,14possy,k9su6i,a26hwk,zvft34,kavrpc,1tn1j4,1r3jis,kamgao,a5bhq8,2b2q,beyt6x,j0y810,muhiww,9xl,a5b7s8,14npcwi,1bkfw1s,4ys,14lipw4,kalr6k,0,1aq,kalqzg,0,48m,2j6hqf,zik0zk,0,33mcjk,0,5' // ;)
    var splitted = magicString.split`,`;
    var binarySequence = splitted.map(function(piece) {
        return ('0'.repeat(32) + // 000000000... this will be padded
            parseInt(a,36) // parseInt('190zcw0',36) -> 000000002722627584
            .toString(2) // -> 10100010010010000000000000000000
        ).substr(-32) // left pad binary sequence
    }).join``; // create one big binary sequence from several smaller
    var groupsOfThree = binarySequence.match(/.{1,3}/g);
    return groupsOfThree.map(function(three) {
        return ` .:\`|;'\n`[parseInt(a,2)]; // magic.. turn 010 into : etc
    }).join``; // create them blaze
}

function printTimeLeft() {
    // this is way longer than it should be.. probably
    var minimumTimeDifference = Math.min(
        dateDiff('/4/20'), // -> Difference between now and 2016/4/20 00:00:00
        dateDiff(' 4:20'), // 2016 04:20:00.. Sadly the 2016 is needed (i think)
        dateDiff(' 0:4:20'), // 2016 00:04:20
        dateDiff(' 16:20'), // Damn 12 hour clock :(
        dateDiff(' 0:16:20'),
        dateDiff(` ${dateString[1]} // 2016 Apr
                   ${dateString[2]+1} // 2016 Apr 13 (12+1)
                   0:4:20` // Check the first occurrence of 4 minutes and 20 seconds
                           // the next day
    )
    var timeInSeconds = minimumTimeDifference / 1000;
    return Math.floor(timeInSeconds) + // ~~ works like Math.floor
        ` minutes and ${Math.floor(timeInSeconds%60)} seconds left until your next hit.`;
}

Try it!

f=
_=>(a=(d=Date)(c=new d(),z=O=>Math.abs(new d(a[3]+O)-c)).split` `)[1]=='Apr'&a[2]==20|~a[4].search(/(04|16):20/)?'0,0,2ca2o,0,10e,0,0,1eu9z4,0,22w,1ulajuo,0,bklxc,2zgg,i,120gdfk,8lc,1s1s,15,j0jf9c,7em8,tac,10,190zcw0,tm8w,ksk,hra0ia,mihog0,3aels,wy,iv8e15,b98u80,cvs1s,575,9fm71g,190zcw0,bg7vgg,1t4,148d4lu,121pblx,b9ea68,2b36,iv8hn5,9zleso,15kytz4,98cp,4fwpwk,zir9ud,1h9u3ln,11c6vb4,84kda8,kbuo05,b98u84,14possy,k9su6i,a26hwk,zvft34,kavrpc,1tn1j4,1r3jis,kamgao,a5bhq8,2b2q,beyt6x,j0y810,muhiww,9xl,a5b7s8,14npcwi,1bkfw1s,4ys,14lipw4,kalr6k,0,1aq,kalqzg,0,48m,2j6hqf,zik0zk,0,33mcjk,0,5'.split`,`.map(a=>('0'.repeat(32)+parseInt(a,36).toString(2)).substr(-32)).join``.match(/.{1,3}/g).map(a=>` .:\`|;'
`[parseInt(a,2)]).join``:~~((T=Math.min(z('/4/20'),z(` ${a[1]} ${++a[2]} 0:4:20`),z(' 4:20'),z(' 0:4:20'),z(' 16:20'),z(' 0:16:20'))/1000)/60)+` minutes and ${~~(T%60)} seconds left until your next hit.`

alert(f())

In the following code snippet you can set the date to test the ascii art

day=prompt('Day?', 12);
month=prompt('Month?', 'Apr');
f=
_=>(a=(d=Date)(c=new d(),z=O=>Math.abs(new d(a[3]+O)-c)).split` `)[1]==month&a[2]==day|~a[4].search(/(04|16):20/)?'0,0,2ca2o,0,10e,0,0,1eu9z4,0,22w,1ulajuo,0,bklxc,2zgg,i,120gdfk,8lc,1s1s,15,j0jf9c,7em8,tac,10,190zcw0,tm8w,ksk,hra0ia,mihog0,3aels,wy,iv8e15,b98u80,cvs1s,575,9fm71g,190zcw0,bg7vgg,1t4,148d4lu,121pblx,b9ea68,2b36,iv8hn5,9zleso,15kytz4,98cp,4fwpwk,zir9ud,1h9u3ln,11c6vb4,84kda8,kbuo05,b98u84,14possy,k9su6i,a26hwk,zvft34,kavrpc,1tn1j4,1r3jis,kamgao,a5bhq8,2b2q,beyt6x,j0y810,muhiww,9xl,a5b7s8,14npcwi,1bkfw1s,4ys,14lipw4,kalr6k,0,1aq,kalqzg,0,48m,2j6hqf,zik0zk,0,33mcjk,0,5'.split`,`.map(a=>('0'.repeat(32)+parseInt(a,36).toString(2)).substr(-32)).join``.match(/.{1,3}/g).map(a=>` .:\`|;'
`[parseInt(a,2)]).join``:~~((T=Math.min(z('/4/20'),z(` ${a[1]} ${++a[2]} 0:4:20`),z(' 4:20'),z(' 0:4:20'),z(' 16:20'),z(' 0:16:20'))/1000)/60)+` minutes and ${~~(T%60)} seconds left until your next hit.`

alert(f())

I think an invalid time like 15:16:20 will be a match on your regex and accidentally display the magic string?

@KevinLau Dang, you're right. Will fix that tomorrow..

I don't think () are necessary for the date constructor: c=new d(), ... can  become just c=new d, ...