Move the first two characters of a given string to the end

bookmark

func first_to_last(_ str1: String) -> String {
    var chars = str1.characters
    let first_char = chars.removeFirst()
    let second_char = chars.removeFirst()
    chars.append(first_char)
    chars.append(second_char)
    
    return String(chars)
}
print(first_to_last("Swift"))
print(first_to_last("Python"))


Output:

iftSw
thonPy