I'm writing Caesar's code. The code works, but the space doesn't apply. For example, "AB" can be transformed "A B" is not converted. Help me.

```
Caesar = function(input){
answer = ""
solution = NULL
Low = "abcdefghijklmnopqrstuvwxyz"
Up = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Lower = strsplit(Low,"")
Lower = Lower[[1]]
Upper = strsplit(Up, "")
Upper = Upper[[1]]
cutI = strsplit(input,"")
cutI = unlist(cutI)
df_Result = data.frame(n.Kan = 1:26)
for(n in 1:26){
answer = ""
for (i in cutI){
if (i %in% ""){
answer = paste0(collapse = "")
} else if (i %in% Lower){
ind = which(Lower == i)
indN = (as.numeric(ind)+n)%%26
if(indN %% 26==0){
indN = 26
}
answer = paste0(c(answer, Lower[indN]),collapse="")
} else{
ind = which(Upper == i)
indN = (as.numeric(ind)+n)%%26
if(indN%%26==0){
indN = 26
}
answer = paste0(c(answer, Upper[indN]), collapse = "")
}
answer=paste0(answer, collapse="")
}
solution = c(solution,answer)
}
df_Result = cbind(df_Result , "Result" = solution)
return(df_Result)
}
```
```