200
13
What happens when the CapsLock key on your keyboard doesn't have a notch in it?
"This hPPENS."
The goal of this program is to consistently emulate keyboard misses where each A press is replaced with CapsLock. Uppercase 'A's from the source should yield the same effect. When CapsLock is enabled, capitalization is reversed.
Test Cases
"The quick brown fox jumps over the lazy dog."
-> "The quick brown fox jumps over the lZY DOG."
"Compilation finished successfully."
-> "CompilTION FINISHED SUCCESSFULLY."
"What happens when the CapsLock key on your keyboard doesn't have a notch in it?"
-> "WhT Hppens when the CPSlOCK KEY ON YOUR KEYBOrd doesn't hVE notch in it?"
"The end of the institution, maintenance, and administration of government, is to secure the existence of the body politic, to protect it, and to furnish the individuals who compose it with the power of enjoying in safety and tranquillity their natural rights, and the blessings of life: and whenever these great objects are not obtained, the people have a right to alter the government, and to take measures necessary for their safety, prosperity and happiness."
-> "The end of the institution, mINTENnce, ND dministrTION OF GOVERNMENT, IS TO SECURE THE EXISTENCE OF THE BODY POLITIC, TO PROTECT IT, nd to furnish the individuLS WHO COMPOSE IT WITH THE POWER OF ENJOYING IN Sfety ND TRnquillity their nTURl rights, ND THE BLESSINGS OF LIFE: nd whenever these greT OBJECTS re not obtINED, THE PEOPLE Hve RIGHT TO lter the government, ND TO Tke meSURES NECESSry for their sFETY, PROSPERITY nd hPPINESS."
"aAaaaaAaaaAAaAa"
-> "" (Without the notch, no one can hear you scream)
"CapsLock locks cAPSlOCK"
-> "CPSlOCK LOCKS CPSlOCK"
"wHAT IF cAPSlOCK IS ALREADY ON?"
-> "wHt if CPSlOCK IS lreDY ON?"
The winning criterion is, as usual, the size of the submitted program's source code.
110Welcome to the site! This is a nice first challenge, and unfortunately very relatable for me and my fT FINGERS. – James – 2018-03-14T18:29:23.957
What characters will be in the input ?
a-zA-Z
? – Rod – 2018-03-14T18:42:32.6105suggested test case :
teSTateSTateSTateST
– Rod – 2018-03-14T18:44:19.673@Rod Look at the examples. Printable ASCII seems to be included. – mbomb007 – 2018-03-14T18:44:35.260
@Rod ->
teSTTEstteSTTEst
. – mbomb007 – 2018-03-14T18:45:18.937@Rod All characters except 'a' or 'A' are allowed in the output. Non-letters do not get changed. – Broadwell – 2018-03-14T18:50:22.867
1@Broadwell He said "input", not "output" – mbomb007 – 2018-03-14T18:56:48.113
2hey so in the future I would recommend using sandbox :P but very good challenge – Christopher – 2018-03-14T19:00:28.073
3
@Christopher is referring to the Sandbox, which is where users typically post questions to ask for improvements.
– Giuseppe – 2018-03-14T19:05:16.15388If only the enter key also had a notch in it so this wouldn' – 12Me21 – 2018-03-14T19:33:18.153
75t happen....... – 12Me21 – 2018-03-14T19:33:28.233
1TIL that @DJMcMayhem was trying to create the nick DJMACMayhem... – Olivier Dulac – 2018-03-15T17:01:37.973
23Literally joined this site to upvote "Without the notch, no one can hear you scream" – lucasvw – 2018-03-15T21:10:11.917
Is the sixth example correct? – Andrea Lazzarotto – 2018-03-16T17:40:48.540
3Why is the title of this question not “No A, just cPS LOCK”? – Janus Bahs Jacquet – 2018-03-16T17:59:29.040
1Wouldn't it be "No , JUST Cps lock"? – 12Me21 – 2018-03-16T20:54:51.550
4I LSO WISH THt my keyboRD Hd a bigger bCKSPce kwt==et=y – Nonny Moose – 2018-03-16T20:58:15.287
@12Me21 I was allowing for not missing the A key when also holding down the shift key at the same time, since shift + caps lock is actually more difficult than shift + A. Also that would make the title completely illegible. But yes, if we went for the purely programmatic approach, it would. – Janus Bahs Jacquet – 2018-03-18T09:58:59.923
Related – Shaggy – 2018-03-19T01:20:54.093
Test case:
correct horse bTTERY STple
– MilkyWay90 – 2019-06-24T15:46:22.520