The Love-Letter Mystery

  • + 0 comments

    C++

    int theLoveLetterMystery(string s)
    {
        int count{0};
        for (int i = s.length() - 1; i >= s.length() / 2; i--)
            count += abs(s[i] - s[s.length() - 1 - i]);
            
        return count;
    }