Use str_split instead of for loop