more verbose solution and easy to understand o(n) & 0(1)
Complexity
Time complexity: O(n)
Space complexity: O(1)
Code
# Complexity
- Time complexity: O(n)
- Space complexity: O(1)

# Code
```python3 []
import string

class Solution:
    def reverseDegree(self, s: str) -> int:
        #initialize list with lowercase alphabets
        alphabet = list(string.ascii_lowercase)

        #creating reversed list 
        i = len(alphabet) -1 
        j = 0
        alphabet_reversed = {}
        while i >= 0:
            alphabet_reversed[alphabet[i]] = j
            j = j + 1
            i = i - 1
        print(alphabet_reversed)

        #creating output
        sum = 0
        for key, char in enumerate(s): 
            if char in alphabet_reversed:
                sum = sum + (key + 1) * (alphabet_reversed.get(char) + 1) 
                print("entrate", sum)

        return sum
```
['Python3']