Skip to content

Instantly share code, notes, and snippets.

@saraswatmks
Created December 17, 2017 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saraswatmks/b21ac30c65485828e11b0a31ae6b4139 to your computer and use it in GitHub Desktop.
Save saraswatmks/b21ac30c65485828e11b0a31ae6b4139 to your computer and use it in GitHub Desktop.
stdin,stdout in R
con = file('stdin', open='r')
inputs <- readLines(con)
n <- inputs[[1]]
n1 <- inputs[[2]]
n1 <- unlist(strsplit(n1, ' '))
n1 <- as.integer(as.factor(n1))
n1 <- n1[length(n1):1]
cat(n1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment