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 – 7 years ago
What characters will be in the input ?
a-zA-Z
? – Rod – 7 years ago5suggested test case :
teSTateSTateSTateST
– Rod – 7 years ago@Rod Look at the examples. Printable ASCII seems to be included. – mbomb007 – 7 years ago
@Rod ->
teSTTEstteSTTEst
. – mbomb007 – 7 years ago@Rod All characters except 'a' or 'A' are allowed in the output. Non-letters do not get changed. – Broadwell – 7 years ago
1@Broadwell He said "input", not "output" – mbomb007 – 7 years ago
2hey so in the future I would recommend using sandbox :P but very good challenge – Christopher – 7 years ago
3
@Christopher is referring to the Sandbox, which is where users typically post questions to ask for improvements.
– Giuseppe – 7 years ago88If only the enter key also had a notch in it so this wouldn' – 12Me21 – 7 years ago
75t happen....... – 12Me21 – 7 years ago
1TIL that @DJMcMayhem was trying to create the nick DJMACMayhem... – Olivier Dulac – 7 years ago
23Literally joined this site to upvote "Without the notch, no one can hear you scream" – lucasvw – 7 years ago
Is the sixth example correct? – Andrea Lazzarotto – 7 years ago
3Why is the title of this question not “No A, just cPS LOCK”? – Janus Bahs Jacquet – 7 years ago
1Wouldn't it be "No , JUST Cps lock"? – 12Me21 – 7 years ago
4I LSO WISH THt my keyboRD Hd a bigger bCKSPce kwt==et=y – Nonny Moose – 7 years ago
@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 – 7 years ago
Related – Shaggy – 7 years ago
Test case:
correct horse bTTERY STple
– MilkyWay90 – 6 years ago