📌 Easy Solution with Python / C / C++
Intuition 🤔The goal is to calculate a “score” for the given string s, which is the sum of the absolute differences between the ASCII values of consecutive chara
# Intuition 🤔
The goal is to calculate a “score” for the given string s, which is the sum of the absolute differences between the ASCII values of consecutive characters in the string. The task involves comparing adjacent characters, converting them to their ASCII values, and summing up the differences.

# Approach 💡
- Iterate through the string, comparing each character $$s[i]$$ with the next one $$s[i+1]$$

- Compute the ASCII value of both characters using ord() (or type casting in C/C++).


# Complexities ⏳
- Time complexity: $$O(n)$$, where  n  is the length of the string. Each character is processed once.

- Space complexity: $$O(1)$$, as only a few variables are used, regardless of the string length.

# Code
```python3 []
class Solution:
    def scoreOfString(self, s: str) -> int:
        N = len(s)
        total = 0
        for i in range(N-1):
            total += abs(ord(s[i]) - ord(s[i+1]))

        return total
```
```C []
int scoreOfString(char* s) {
    int total = 0;
    for (int i = 0; s[i+1] != '\0'; i++)
        total += abs((int)s[i] - (int)s[i + 1]);

    return total;
}
```

```C++ []
class Solution {
public:
    int scoreOfString(string s) {
        int N = s.length();
        int total = 0;
        for (int i = 0; i < N-1; i++) {
            total += abs((int)s[i] - (int)s[i + 1]);
        }

        return total;
    }
};
```
['C', 'C++', 'Python3']