Problems with splice!/deleteat!

hi there,
i wrote a code that take a text and return the same text without the whitespaces and the punctuation. I can’t understand why i’m getting errors about the index of splice!: “attempt to access 7-element Vector{Char} at index [8]”. This is the code:

t = readlines("latino.txt")
s1 = join(t, ' ')
t1 = sort(split(s1))
t2 = []
for element in t1
    g = collect(element)
    for i in 1 : length(g)
        if isletter(g[i]) == false
           splice!(g, i)
    push!(t2, g)

this is the text i chose

length(g) is evaluated once at the beginning of the loop, but you shorten g in the body of the loop, so you walk past the end of the new shortened g.