simple solution with explanation
Intuition\n- substract adjacent characters and add this absolute value in res\n\n# Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n
# Intuition\n- substract adjacent characters and add this absolute value in res\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: Constatnt Space\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int scoreOfString(string s) {\n        int n = s.size(), res = 0;\n        for(int i=0;i<n-1;i++)res+=abs(s[i]-s[i+1]);\n        return res;\n    }\n};\n```
['C++']