Tweeted twitter.com/#!/StackCodeGolf/status/616185759708676097 occurred Jul 1 '15 at 10:05 5 Embedded image, fixed some spelling and grammar, clarified some standard things edited Jun 30 '15 at 14:34 Alex A. 22.9k55 gold badges3131 silver badges104104 bronze badges INPUT: Any string consisting exclusively of lowercase letters via function argument, command line argument, STDIN, or similar. OUTPUT: APrint or return a number that will represent the sum of the distances of the letters according to the following metric: You take the first and second letter and count the distance between them, the. The distance is defined by the QWERTY keyboard layout, where every adjecentadjacent letter in the same row is 1has distance 1 and every adjecentadjacent letter in athe same column is 2has distance, to 2. To measure the distance ofbetween letters that arent adjecentaren't adjacent, you take the shortest waypath between thosethe two.  Examples: q->w areis 1 distance apart q->e areis 2 distance q->a areis 2 distance q->s areis 3 distance (q->a->s or q->w->s) q->m is 10 distance  Then you take the second and third letter, then the third and fourth..., etc., until you reach the end of the input. The output is the sum of all those distances. Example input outputsand output: INPUT: qwer OUTPUT: 3 INPUT: qsx OUTPUT: 5 INPUT: qmq OUTPUT: 20 INPUT: tttt OUTPUT: 0  Here is also aan image showing which letters are in the same row imagecolumn: This is code golf, so the shortest code in bytes wins! INPUT: Any string consisting exclusively of lowercase letters OUTPUT: A number that will represent the sum of the distances of the letters according to the following metric: You take the first and second letter and count the distance between them, the distance is defined by the QWERTY keyboard layout, where every adjecent letter in the same row is 1 distance and every adjecent letter in a column is 2 distance, to measure the distance of letters that arent adjecent you take the shortest way between those two. Examples: q->w are 1 distance apart q->e are 2 distance q->a are 2 distance q->s are 3 distance (q->a->s or q->w->s) q->m is 10 distance  Then you take the second and third letter, then the third and fourth... etc. until you reach the end of the input. The output is the sum of all those distances. Example input outputs: INPUT: qwer OUTPUT: 3 INPUT: qsx OUTPUT: 5 INPUT: qmq OUTPUT: 20 INPUT: tttt OUTPUT: 0  Here is also a image showing which letters are in the same row image This is code golf, so the shortest code wins! INPUT: Any string consisting exclusively of lowercase letters via function argument, command line argument, STDIN, or similar. OUTPUT: Print or return a number that will represent the sum of the distances of the letters according to the following metric: You take the first and second letter and count the distance between them. The distance is defined by the QWERTY keyboard layout, where every adjacent letter in the same row has distance 1 and every adjacent letter in the same column has distance 2. To measure the distance between letters that aren't adjacent, you take the shortest path between the two.  Examples: q->w is 1 distance apart q->e is 2 distance q->a is 2 distance q->s is 3 distance (q->a->s or q->w->s) q->m is 10 distance  Then you take the second and third letter, then the third and fourth, etc., until you reach the end of the input. The output is the sum of all those distances. Example input and output: INPUT: qwer OUTPUT: 3 INPUT: qsx OUTPUT: 5 INPUT: qmq OUTPUT: 20 INPUT: tttt OUTPUT: 0  Here is an image showing which letters are in the same column: This is code golf, so the shortest code in bytes wins! 4 added 52 characters in body edited Jun 30 '15 at 12:27 SuperJedi224 10.1k11 gold badge3535 silver badges6363 bronze badges INPUT: Any string with small caseconsisting exclusively of lowercase letters only OUTPUT: A number that will represent the sum of the distances of the letters according to this rulethe following metric: You take the first and second letter and count the distance between them, the distance is defined by the QWERTY keyboard layout, where every adjecent letter in the same row is 1 distance and every adjecent letter in a column is 2 distance, to measure the distance of letters that arent adjecent you take the shortest way between those two. Examples: q->w are 1 distance apart q->e are 2 distance q->a are 2 distance q->s are 3 distance (q->a->s or q->w->s) q->m is 10 distance  Then you take the second and third letter, then the third and fourth... etc. until you reach the end of the input. The output is the sum of all those distances. Example input outputs: INPUT: qwer OUTPUT: 3 INPUT: qsx OUTPUT: 5 INPUT: qmq OUTPUT: 20 INPUT: tttt OUTPUT: 0  Here is also a image showing which letters are in the same row image ShortestThis is code golf, so the shortest code wins! INPUT: Any string with small case letters only OUTPUT: A number that will represent the sum of the distances of the letters according to this rule: You take the first and second letter and count the distance between them, the distance is defined by the QWERTY keyboard layout, where every adjecent letter in the same row is 1 distance and every adjecent letter in a column is 2 distance, to measure the distance of letters that arent adjecent you take the shortest way between those two. Examples: q->w are 1 distance apart q->e are 2 distance q->a are 2 distance q->s are 3 distance (q->a->s or q->w->s) q->m is 10 distance  Then you take the second and third letter, then the third and fourth... etc. until you reach the end of the input. The output is the sum of all those distances. Example input outputs: INPUT: qwer OUTPUT: 3 INPUT: qsx OUTPUT: 5 INPUT: qmq OUTPUT: 20 INPUT: tttt OUTPUT: 0  Here is also a image showing which letters are in the same row image Shortest code wins! INPUT: Any string consisting exclusively of lowercase letters OUTPUT: A number that will represent the sum of the distances of the letters according to the following metric: You take the first and second letter and count the distance between them, the distance is defined by the QWERTY keyboard layout, where every adjecent letter in the same row is 1 distance and every adjecent letter in a column is 2 distance, to measure the distance of letters that arent adjecent you take the shortest way between those two. Examples: q->w are 1 distance apart q->e are 2 distance q->a are 2 distance q->s are 3 distance (q->a->s or q->w->s) q->m is 10 distance  Then you take the second and third letter, then the third and fourth... etc. until you reach the end of the input. The output is the sum of all those distances. Example input outputs: INPUT: qwer OUTPUT: 3 INPUT: qsx OUTPUT: 5 INPUT: qmq OUTPUT: 20 INPUT: tttt OUTPUT: 0  Here is also a image showing which letters are in the same row image This is code golf, so the shortest code wins! 3 edited tags | link edited Jun 30 '15 at 12:26 Martin Ender 171k6161 gold badges404404 silver badges887887 bronze badges 2 added 114 characters in body edited Jun 30 '15 at 12:25 Vajura 20711 silver badge1515 bronze badges 1 asked Jun 30 '15 at 12:19 Vajura 20711 silver badge1515 bronze badges