6
\$\begingroup\$

If you've come here, you probably know what is, and that's what I'm going to assume.

Story

(I guess)


Keyboards are input devices we use all the time. They existed before mice and touch screen, etc.

Their fundamentals have not changed: when you press a key down, a signal is sent to the computer. When you release it, another signal is sent.

So here's the challenge: calculate the minimum number of signals(length of a signal does not matter) depending on the input string.

Example:

Input:

test

Output:

8

Explanation: All keys have to be pressed down and released


Input2:

TEst

Output2:

10

Explanation: Shift has to be pressed, then T, down, up, E, down, up, then release shift, then s down, up, then t down, up, totalling up to 10.


Rules

Any language is accepted.
This is , so shortest code in bytes wins.
Programs with incorrect outputs will be disqualified.

Happy golfing!

Edit:

The keyboard layout used should be this: http://dry.sailingissues.com/keyboard-US-International.png

Only characters in this keyboard layout will be used (+lowercase letters).

Using Caps-Lock is ok, since it DOES have an advantage: numbers remain numbers while letters become uppercase.

\$\endgroup\$

closed as unclear what you're asking by Dada, Luis Mendo, Leaky Nun, Erik the Outgolfer, totallyhuman Jun 27 '17 at 14:45

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ Please specify what keyboard you are using for scoring this challenge, with a picture/diagram, if possible. \$\endgroup\$ – Stephen Jun 27 '17 at 14:35
  • 3
    \$\begingroup\$ What is expected output for tttttt? Since I can hold the button down. Personally you should score this on key presses. \$\endgroup\$ – Stephen Jun 27 '17 at 14:36
  • 7
    \$\begingroup\$ Welcome to PPCG! This looks like a great first challenge, but as you may have noted from the questions in the comments: it might need some tweaking. We've got the Sandbox for Proposed Challenges for that exact purpose. There you can post it, let other people leave feedback to perfect your challenge, and when it's ready (and at least 48 hours has passed) it can be posted on the main. Just something to keep in mind for next time. Again, welcome, and nice challenge! :) \$\endgroup\$ – Kevin Cruijssen Jun 27 '17 at 14:43
  • \$\begingroup\$ @StephenS it is considered as 12 signals. \$\endgroup\$ – DaniFoldi Jun 27 '17 at 14:44
  • 3
    \$\begingroup\$ If characters in that keyboard will be used, can you include testcases with those special characters? \$\endgroup\$ – Leaky Nun Jun 27 '17 at 14:44

Browse other questions tagged or ask your own question.