R, (削除) 82 (削除ここまで) 76(削除) 76 (削除ここまで) 75 bytes
function(s,n)cat(unlist(Map(rep,(S<-el(strsplit(s,""'')),c(n,rep(1,n-1))+!seq(S)),sep=""sep='')
A function; takes a string s and an integer n, and prints the repeated version to stdout.
Explanation:
function(s,n){
charsS <- el(strsplit(s,"")) # characters
r <- c(n,rep(1,n-1)) # [n, 1, 1,...,1], length n
repeatedrepeats <- Map(rep, chars, r) # Map computes repr+!seq(chars,rS) # recyclingextends theR shorterto aslength needed.of S
cat(unlistrep(repeatedS, repeats),sep="") # print out
}
R , 55 bytes
function(S,n)cat(rep(S,c(n,rep(1,n-1))+!seq(S)),sep="")
Same algorithm as above, but with S taken as a list of individual characters.
R, (削除) 82 (削除ここまで) 76 bytes
function(s,n)cat(unlist(Map(rep,el(strsplit(s,"")),c(n,rep(1,n-1)))),sep="")
A function; takes a string s and an integer n, and prints the repeated version to stdout.
Explanation:
function(s,n){
chars <- el(strsplit(s,"")) # characters
r <- c(n,rep(1,n-1)) # [n, 1, 1,...,1], length n
repeated <- Map(rep, chars, r) # Map computes rep(chars,r) # recycling the shorter as needed.
cat(unlist(repeated),sep="") # print out
}
R, (削除) 82 (削除ここまで) (削除) 76 (削除ここまで) 75 bytes
function(s,n)cat(rep(S<-el(strsplit(s,'')),c(n,rep(1,n-1))+!seq(S)),sep='')
A function; takes a string s and an integer n, and prints the repeated version to stdout.
Explanation:
function(s,n){
S <- el(strsplit(s,"")) # characters
r <- c(n,rep(1,n-1)) # [n, 1, 1,...,1], length n
repeats <- r+!seq(S) # extends R to length of S
cat(rep(S, repeats),sep="") # print out
}
R , 55 bytes
function(S,n)cat(rep(S,c(n,rep(1,n-1))+!seq(S)),sep="")
Same algorithm as above, but with S taken as a list of individual characters.
R, 82(削除) 82 (削除ここまで) 76 bytes
function(s,n)cat(unlist(mapplyMap(rep,el(strsplit(scan(,"")s,"")),c(n<-scan()n,rep(1,n-1)))),sep="")
Takes theA function; takes a strings and an integer n from stdin, and prints the repeated version to stdout.
Explanation:
function(s,n){
chars <- el(strsplit(s,"")) # characters
r <- c(n,rep(1,n-1)) # [n, 1, 1,...,1], length n
repeated <- Map(rep, chars, r) # Map computes rep(chars,r)
# recycling the shorter as needed.
cat(unlist(repeated),sep="") # print out
}
R, 82 bytes
cat(unlist(mapply(rep,el(strsplit(scan(,""),"")),c(n<-scan(),rep(1,n-1)))),sep="")
Takes the string and n from stdin and prints the repeated version to stdout.
R, (削除) 82 (削除ここまで) 76 bytes
function(s,n)cat(unlist(Map(rep,el(strsplit(s,"")),c(n,rep(1,n-1)))),sep="")
A function; takes a strings and an integer n, and prints the repeated version to stdout.
Explanation:
function(s,n){
chars <- el(strsplit(s,"")) # characters
r <- c(n,rep(1,n-1)) # [n, 1, 1,...,1], length n
repeated <- Map(rep, chars, r) # Map computes rep(chars,r)
# recycling the shorter as needed.
cat(unlist(repeated),sep="") # print out
}