In Swift, Takes a string and returns the nth character from the end, where 0 is the last character in the string.
// Takes a string and returns the nth character from the end, where 0 is the last character in the string.
func reversestrindex(str: String, index: Int) ->Character {
var reversedstrArray = Array(reverse(str))
return reversedstrArray[index]
}
reversestrindex("power", 2)
// "w"