Array index error in Swift while doing shuffle in string

I need to do the shuffle string in swift. When given a string("codeleet") and array of indices([4,5,6,7,0,2,1,3]). I need to shuffle the character of the string in the position of indices. But when I am writing the following code: indices[5] is printed as "d" but not as "o".It prints "leetcdoe" instead of "leetcode".

That looks correct. Are you sure you typed in the index numbers how you intended?