String Score Calculation Using ASCII Differences
IntuitionThe problem requires calculating a "score" for a given string based on the absolute difference between adjacent character ASCII values. By iterating th
# Intuition
The problem requires calculating a "score" for a given string based on the absolute difference between adjacent character ASCII values. By iterating through the string and summing these differences, we obtain the final score. This approach efficiently captures variations in character sequences.

# Approach
1. Initialize result to store the sum.
2. Iterate through the string from index 0 to size - 2.
3. For each character pair (s[i], s[i+1]), compute abs(s[i] - s[i+1]) and add it to result.
4. Return the final computed result.

# Complexity
- Time complexity:
O(N), where N is the length of the string. We traverse the string once, performing constant-time operations per character.

- Space complexity:
O(1), as only a few integer variables are used, independent of input size.

# Code
```cpp []
class Solution {
public:
    int scoreOfString(string s) {
        int result = 0;
        for(int i = 0; i < s.size() -1; i++)
        {
            result = result + abs(s[i] - s[i+1]);
        }
        return result;
    }
};
```
['Math', 'String', 'Iterator', 'C++']