The Love-Letter Mystery
Solutions To solve this challenge we need to calculate the “distance” between the first and the last character, the second and the second to last, etc. We can do it only for the first half of the string:
1 2 a b c d => |a-d| + |b-c| That can be coded in C++ as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 size_t T; cin >> T; string s; while (T--) { cin >> s; auto count = 0; auto first = s.
[Read More]