Simple java solution
Complexity\n- Time complexity: O(n) \n\n- Space complexity: O(1)\n\n# Code\n\nclass Solution {\n    public int scoreOfString(String s) {\n        int val=0;\n  
# Complexity\n- Time complexity: $$O(n)$$ \n\n- Space complexity: $$O(1)$$\n\n# Code\n```\nclass Solution {\n    public int scoreOfString(String s) {\n        int val=0;\n        for(int i=0;i<s.length()-1;i++)\n        {\n            char c=s.charAt(i);\n            char d=s.charAt(i+1);\n            val=val+Math.abs(c-d);\n        }\n        return val;\n    }\n}\n```
['Java']