fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. class Solution {
  5. public:
  6. int scoreOfString(string s) {
  7. int score = 0;
  8. for (int i = 1 ; i < s.size() ; i++) {
  9. score += abs(int(s[i]) - int(s[i-1]));
  10. }
  11. return score;
  12. }
  13. };
  14.  
  15. int main() {
  16. // your code goes here
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty