# R, <s>66</s> <s>48</s> <s>46</s> 43 bytes <!-- language-all: lang-r --> function(s)identical(x<-rle(s)$v,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 and 3 thanks to Albert Masclans!