# R, <s>66</s> <s>48</s> 46 bytes <!-- language-all: lang-r --> function(s)identical(x<-rle(s)[[2]],unique(x)) 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. It certainly isn't 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 is identical to itself with duplicates removed, return `TRUE`, otherwise `FALSE`. [Verify all test cases online](http://www.r-fiddle.org/#/fiddle?id=R8cXhmZ0&version=2) Saved 20 bytes thanks to MickyT!