Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Can be the problem divided in parts, so solving each part and sum their solutions it should return the answer? Yes, you only need to divide the problem in finger jumps.
In each finger jump you need to move your finger from one character to another, you need to know its index.
Map each character to it's index.
Use a hash table to do that.