Easy 3 line code
IntuitionThe question asked us to find the absolute difference of each letter with the next and sum up all these diffrencesApproachWhen we try storing a charcte
# Intuition
The question asked us to find the absolute difference of each letter with the next and sum up all these diffrences 
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
When we try storing a charcter in an integer varaible or perform mathematical functions java automatically converts the character to it's ascii value 
the difference I need to find is ascii value of - current letter and letter+1
so , 
> s.charAt(i)-s.charAt(i+1) 
<!-- Describe your approach to solving the problem. -->
gives me the the difference 
now to make it absolute we use 
> Math.abs
<!-->
the value returned by math .abs is double so we use 
> (int)
<!-->
for type conversion from double to integer
we keep adding this difference every iteration of the loop until length-1 of the string storing it in score 
returning score as the final answer 


# Complexity
- Time complexity: O(n)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public int scoreOfString(String s) 
    {
        int score=0;
        for (int i=0;i<s.length()-1;i++)
        {
           score+=(int)Math.abs(s.charAt(i)-s.charAt(i+1));
           
        }
        return score;
        
    }
}
```
['String', 'Java']