Swift solution
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    func scoreOfString(_ s: String) -> Int {\n        var result = 0\n        var firstInd = s.startIndex\n        var secondInd = s.index(after: firstInd)\n        while secondInd != s.endIndex {\n            result += abs(Int(s[firstInd].asciiValue!) - Int(s[secondInd].asciiValue!))\n            firstInd = s.index(after: firstInd)\n            secondInd = s.index(after: secondInd)\n        }\n        return result\n    }\n}\n\n```
['String', 'Swift']