Keyboard Distance Typing

Medium
string manhattan-distance keyboard-layout calculation
Problem Description

Calculate the total typing distance between two words using a standard QWERTY keyboard layout. Distance is measured as Manhattan distance between key positions.

Input Format
Two words on separate lines, containing only lowercase letters.
Output Format
Total Manhattan distance for typing from first word to second word.
Constraints
• 1 ≤ word length ≤ 100
• Words contain only lowercase letters a-z
• Use standard QWERTY layout positions
• Calculate Manhattan distance between key positions
• Sum distances for all character transitions
Sample Input/Output
Input:
hello
world
Output:
32
Explanation

Calculate distance from each character in "hello" to corresponding character in "world" using QWERTY positions.

Solution Hints
85
Points
2000ms
Time Limit
128MB
Memory Limit
Code Editor
Register to Submit
Register to Access Code Editor

Create a free account to solve coding problems and track your progress.

Register Now
Feedback