Stopwatch for Alphabets Implement Stopwatch for typing Alphabets

Alphabets = "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".

Note


The program should run infinitely and should stop only when Esc button is pressed.
The stopwatch starts with keystroke "a" and ends with keystroke "z"
Output is the time taken to type the Alphabets correctly (ie. time take for 51 keystrokes)
If an illegal character occurs then stopwatch should stop and print "Failed"
If a new record is set then print "!!New record!!," TimeTaken

where, TimeTaken = time taken to print alphabets correctly.


Winner: One with the shortest code.
Mathematica, 303

Here with white-space and expanded symbols.
Everything happens in the Switch statement of the EventHandler where I pattern match {pressed key, next letter}.

Might want to replace the Quit with something less sinister before hitting escape:

z := AbsoluteTime[];
f = "a"; y = Dynamic;
DynamicModule[{
  a = f~CharacterRange~"z", c = 1, d = f, r = \[Infinity]},
 EventHandler[
  y@d~InputField~String,
  "KeyDown" :&gt; Switch[
    {CurrentValue@"EventKey", a[[c]]},
    {f ..},
      t = z; c++; d = y@a[[c]],
    {"z" ..}, 
      t = z - t;
      d = If[t &lt; r,
         r = t; "!!New record!!,",
         ""] ~~ ToString@t;
      c = 1,
    {a_, a_},
      c++,
    {"\[RawEscape]", _}, Quit[],
    _, d = "Failed"; c = 1]]]