Keyboard vs Code-Golf?

6

1

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.

DaniFoldi

Posted 2017-06-27T14:34:11.180

Reputation: 71

Question was closed 2017-06-27T14:45:57.963

1Please specify what keyboard you are using for scoring this challenge, with a picture/diagram, if possible. – Stephen – 2017-06-27T14:35:19.027

3What is expected output for tttttt? Since I can hold the button down. Personally you should score this on key presses. – Stephen – 2017-06-27T14:36:44.853

7

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! :)

– Kevin Cruijssen – 2017-06-27T14:43:12.387

@StephenS it is considered as 12 signals. – DaniFoldi – 2017-06-27T14:44:37.597

3If characters in that keyboard will be used, can you include testcases with those special characters? – Leaky Nun – 2017-06-27T14:44:53.007

So, we can choose if Caps Lock is on or off? Also, should we use Caps Lock or shift for a case like A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z., assuming Caps Lock is off by default? Using Caps Lock is fewer signals in this case. Also what about the special chars? – Erik the Outgolfer – 2017-06-27T14:47:49.610

What happens when Shift is pressed, CapsLock is on, and you press a letter? – CalculatorFeline – 2017-06-27T15:11:26.363

This is an awesome challenge, rewrite it in the sandbox and we'll help. – Magic Octopus Urn – 2017-06-27T15:39:52.900

I really like this challenge, still you need to specify the keyboard + layout in detail. For example I use Neo2, so things like ∀ε>0:∃n∈ℕ ... take me a maximum of 3*(press + release) = 6 signals for each character.

– P. Siehr – 2017-06-28T07:25:01.420

No answers