카타 7급 Mumbling

1 Kotlin[ | ]

2 R[ | ]

accum <- function(s){
  v <- unlist(strsplit(s,''))
  for(i in 1:length(v)){
    v[i] <- paste0(toupper(v[i]), paste(rep(tolower(v[i]), i-1), collapse=''), collapse='')
  }
  paste(v, collapse='-')
}
accum <- function(s){
  n <- nchar(s)
  str <- unlist(strsplit(s,""))
  res <- {}
  for (i in 1: n){
    res[i] <- paste0(c(toupper(str[i]),rep(tolower(str[i]),i-1)),collapse ="")
  }
  result <- paste0(res, collapse= "-")
}
accum <- function(s){
  s <- unlist(strsplit(casefold(s), ""))
  res <- character()
  for (i in seq_along(s)){
    res <- c(res, paste(rep(s[i], i), collapse = "")) 
  }
  res[1] <- toupper(res[1])
  res[-1] <- tools::toTitleCase(res[-1])
  paste(res, collapse = "-")
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}