look.and.say <- function(x, return.an.int=FALSE)
{
   
   xstr <- unlist(strsplit(as.character(x), ""))
   
   rlex <- rle(xstr)
   
   odds <- as.character(rlex$lengths)
   evens <- rlex$values
   newstr <- as.vector(rbind(odds, evens))
   
   newstr <- paste(newstr, collapse="")
   
   if(return.an.int) as.integer(newstr) else newstr
}