#3110

Score of a String

easy · 91.4% accepted · 840 likes · top 100%

string

⊣ practice⊣ open on leetcode ↗

Description

You are given a string s. The score of a string is defined as the sum of the absolute difference between the ASCII values of adjacent characters.

Return the score of s.

Solution