Score of a String | 0ms and 100.00% beats
IntuitionThe problem requires us to compute the score of a string by summing the absolute differences between adjacent character ASCII values. We can solve this
# Intuition
The problem requires us to compute the score of a string by summing the absolute differences between adjacent character ASCII values. We can solve this efficiently by iterating through the string once.

# Approach
1. Convert each character in the string to its ASCII value using `ord()`.
2. Use `zip()` to pair adjacent ASCII values.
3. Compute the absolute difference for each pair.
4. Sum up the differences to get the final score.

# Complexity
- **Time complexity:** $$O(n)$$, as we iterate through the string once.
- **Space complexity:** $$O(1)$$, since we use only a few extra variables.

# Code
```python
from itertools import pairwise

class Solution:
    def scoreOfString(self, s: str) -> int:
        return sum(abs(a - b) for a, b in zip(map(ord, s), map(ord, s[1:])))
```
['Python3']