Problem:
Score : 200 points

Problem Statement

You are given a string S. Each character of S is uppercase or lowercase English letter.
Determine if S satisfies all of the following conditions:

The initial character of S is an uppercase A.

There is exactly one occurrence of C between the third character from the beginning and the second to last character (inclusive).

All letters except the A and C mentioned above are lowercase.

Constraints

4 ≤ |S| ≤ 10 (|S| is the length of the string S.)

Each character of S is uppercase or lowercase English letter.

Input

Input is given from Standard Input in the following format:

S

Output

If S satisfies all of the conditions in the problem statement, print AC; otherwise, print WA.

Sample Input 1

AtCoder

Sample Output 1

AC

The first letter is A, the third letter is C and the remaining letters are all lowercase, so all the conditions are satisfied.

Sample Input 2

ACoder

Sample Output 2

WA

The second letter should not be C.

Sample Input 3

AcycliC

Sample Output 3

WA

The last letter should not be C, either.

Sample Input 4

AtCoCo

Sample Output 4

WA

There should not be two or more occurrences of C.

Sample Input 5

Atcoder

Sample Output 5

WA

The number of C should not be zero, either.

Solution in JavaScript (node.js v5.12) (judge verdict: Wrong Answer)

parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"Focm":[function(require,module,exports) {
var n={};!function(n){"use strict";var t=function(n){this.compose=n},r=new t(function(n){return function(t){return function(r){return n(t(r))}}});n.compose=function(n){return n.compose},n.Semigroupoid=t,n.semigroupoidFn=r}(n["Control.Semigroupoid"]=n["Control.Semigroupoid"]||{}),function(t){"use strict";var r=n["Control.Semigroupoid"],e=function(n,t){this.Semigroupoid0=n,this.identity=t},a=new e(function(){return r.semigroupoidFn},function(n){return n});t.Category=e,t.identity=function(n){return n.identity},t.categoryFn=a}(n["Control.Category"]=n["Control.Category"]||{}),function(t){"use strict";(n["Data.Boolean"]=n["Data.Boolean"]||{}).otherwise=!0}(),function(t){"use strict";n["Control.Category"],n["Data.Boolean"],n["Data.Ord"],n["Data.Ring"];t.flip=function(n){return function(t){return function(r){return n(r)(t)}}},t.const=function(n){return function(t){return n}}}(n["Data.Function"]=n["Data.Function"]||{}),function(t){"use strict";(n["Data.Unit"]=n["Data.Unit"]||{}).unit={}}(),function(t){"use strict";n["Data.Show"],n["Data.Symbol"],n["Record.Unsafe"],n["Type.Data.RowList"];t.Show=function(n){this.show=n},t.show=function(n){return n.show}}(n["Data.Show"]=n["Data.Show"]||{}),function(t){"use strict";var r=n["Data.Unit"];n["Data.Show"];t.unit=r.unit}(n["Data.Unit"]=n["Data.Unit"]||{}),function(t){"use strict";n["Data.Functor"];var r=n["Control.Semigroupoid"],e=n["Data.Function"],a=n["Data.Unit"],o=function(n){this.map=n},i=function(n){return n.map},u=new o(r.compose(r.semigroupoidFn));t.Functor=o,t.map=i,t.void=function(n){return i(n)(e.const(a.unit))},t.functorFn=u}(n["Data.Functor"]=n["Data.Functor"]||{}),function(t){"use strict";n["Control.Apply"];var r=n["Control.Category"],e=n["Data.Function"],a=n["Data.Functor"],o=function(n){return n.apply};t.Apply=function(n,t){this.Functor0=n,this.apply=t},t.apply=o,t.applySecond=function(n){return function(t){return function(i){return o(n)(a.map(n.Functor0())(e.const(r.identity(r.categoryFn)))(t))(i)}}}}(n["Control.Apply"]=n["Control.Apply"]||{}),function(t){"use strict";var r=n["Control.Apply"],e=(n["Data.Functor"],n["Data.Unit"],function(n){return n.pure});t.Applicative=function(n,t){this.Apply0=n,this.pure=t},t.pure=e,t.liftA1=function(n){return function(t){return function(a){return r.apply(n.Apply0())(e(n)(t))(a)}}}}(n["Control.Applicative"]=n["Control.Applicative"]||{}),function(t){"use strict";n["Control.Bind"],n["Control.Applicative"],n["Control.Apply"],n["Control.Category"];var r=n["Data.Function"],e=(n["Data.Functor"],n["Data.Unit"],function(n){return n.bind}),a=function(n){return r.flip(e(n))};t.Bind=function(n,t){this.Apply0=n,this.bind=t},t.bind=e,t.bindFlipped=a,t.composeKleisliFlipped=function(n){return function(t){return function(r){return function(e){return a(n)(t)(r(e))}}}}}(n["Control.Bind"]=n["Control.Bind"]||{}),function(n){"use strict";n.range=function(n){return function(t){for(var r=n>t?-1:1,e=new Array(r*(t-n)+1),a=n,o=0;a!==t;)e[o++]=a,a+=r;return e[o]=a,e}},n.length=function(n){return n.length},n.filter=function(n){return function(t){return t.filter(n)}},n.zipWith=function(n){return function(t){return function(r){for(var e=t.length<r.length?t.length:r.length,a=new Array(e),o=0;o<e;o++)a[o]=n(t[o])(r[o]);return a}}}}(n["Data.Array"]=n["Data.Array"]||{}),function(t){"use strict";(n["Data.Eq"]=n["Data.Eq"]||{}).refEq=function(n){return function(t){return n===t}}}(),function(n){"use strict";n.boolConj=function(n){return function(t){return n&&t}},n.boolDisj=function(n){return function(t){return n||t}},n.boolNot=function(n){return!n}}(n["Data.HeytingAlgebra"]=n["Data.HeytingAlgebra"]||{}),function(t){"use strict";var r=n["Data.HeytingAlgebra"],e=(n["Data.Symbol"],n["Data.Unit"],n["Record.Unsafe"],n["Type.Data.Row"],n["Type.Data.RowList"],function(n,t,r,e,a,o){this.conj=n,this.disj=t,this.ff=r,this.implies=e,this.not=a,this.tt=o}),a=function(n){return n.not},o=function(n){return n.disj},i=new e(r.boolConj,r.boolDisj,!1,function(n){return function(t){return o(i)(a(i)(n))(t)}},r.boolNot,!0);t.HeytingAlgebra=e,t.tt=function(n){return n.tt},t.ff=function(n){return n.ff},t.implies=function(n){return n.implies},t.conj=function(n){return n.conj},t.disj=o,t.not=a,t.heytingAlgebraBoolean=i}(n["Data.HeytingAlgebra"]=n["Data.HeytingAlgebra"]||{}),function(t){"use strict";var r=n["Data.Eq"],e=(n["Data.HeytingAlgebra"],n["Data.Symbol"],n["Data.Unit"],n["Data.Void"],n["Record.Unsafe"],n["Type.Data.RowList"],function(n){this.eq=n}),a=new e(r.refEq);t.Eq=e,t.eq=function(n){return n.eq},t.eqChar=a}(n["Data.Eq"]=n["Data.Eq"]||{}),function(n){"use strict";n.foldrArray=function(n){return function(t){return function(r){for(var e=t,a=r.length-1;a>=0;a--)e=n(r[a])(e);return e}}},n.foldlArray=function(n){return function(t){return function(r){for(var e=t,a=r.length,o=0;o<a;o++)e=n(e)(r[o]);return e}}}}(n["Data.Foldable"]=n["Data.Foldable"]||{}),function(t){"use strict";var r=n["Control.Applicative"],e=(n["Control.Apply"],n["Control.Bind"]);n["Data.Functor"],n["Data.Unit"];t.Monad=function(n,t){this.Applicative0=n,this.Bind1=t},t.ap=function(n){return function(t){return function(a){return e.bind(n.Bind1())(t)(function(t){return e.bind(n.Bind1())(a)(function(e){return r.pure(n.Applicative0())(t(e))})})}}}}(n["Control.Monad"]=n["Control.Monad"]||{}),function(t){"use strict";n["Data.Semigroup"],n["Data.Symbol"],n["Data.Unit"],n["Data.Void"],n["Record.Unsafe"],n["Type.Data.RowList"];t.Semigroup=function(n){this.append=n},t.append=function(n){return n.append}}(n["Data.Semigroup"]=n["Data.Semigroup"]||{}),function(t){"use strict";n["Data.Boolean"],n["Data.Eq"],n["Data.EuclideanRing"],n["Data.Ord"],n["Data.Ordering"],n["Data.Semigroup"],n["Data.Symbol"],n["Data.Unit"],n["Record.Unsafe"],n["Type.Data.RowList"];t.Monoid=function(n,t){this.Semigroup0=n,this.mempty=t},t.mempty=function(n){return n.mempty}}(n["Data.Monoid"]=n["Data.Monoid"]||{}),function(t){"use strict";n["Control.Alt"],n["Control.Alternative"],n["Control.Applicative"],n["Control.Apply"],n["Control.Bind"];var r=n["Control.Category"],e=(n["Control.Extend"],n["Control.Monad"],n["Control.MonadZero"],n["Control.Plus"],n["Data.Bounded"],n["Data.Eq"]),a=(n["Data.Function"],n["Data.Functor"],n["Data.Functor.Invariant"],n["Data.Monoid"],n["Data.Ord"],n["Data.Ordering"],n["Data.Semigroup"],n["Data.Show"],n["Data.Unit"],n.Prelude,function(){function n(){}return n.value=new n,n}()),o=function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}(),i=function(n){return function(t){return function(r){if(r instanceof a)return n;if(r instanceof o)return t(r.value0);throw new Error("Failed pattern match at Data.Maybe (line 217, column 1 - line 217, column 51): "+[n.constructor.name,t.constructor.name,r.constructor.name])}}};t.Nothing=a,t.Just=o,t.maybe=i,t.fromMaybe=function(n){return i(n)(r.identity(r.categoryFn))},t.eqMaybe=function(n){return new e.Eq(function(t){return function(r){return t instanceof a&&r instanceof a||t instanceof o&&r instanceof o&&e.eq(n)(t.value0)(r.value0)}})}}(n["Data.Maybe"]=n["Data.Maybe"]||{}),function(t){"use strict";n["Control.Applicative"],n["Control.Apply"],n["Control.Bind"],n["Control.Monad"],n["Data.Bounded"],n["Data.Eq"],n["Data.Functor"];var r=n["Data.HeytingAlgebra"],e=n["Data.Monoid"],a=(n["Data.Ord"],n["Data.Semigroup"]),o=(n["Data.Semiring"],n["Data.Show"],n.Prelude,function(n){return new a.Semigroup(function(t){return function(e){return r.disj(n)(t)(e)}})});t.Disj=function(n){return n},t.semigroupDisj=o,t.monoidDisj=function(n){return new e.Monoid(function(){return o(n)},r.ff(n))}}(n["Data.Monoid.Disj"]=n["Data.Monoid.Disj"]||{}),function(t){"use strict";n["Control.Semigroupoid"],n["Data.Function"];var r=n["Data.Functor"],e=(n["Data.Monoid.Additive"],n["Data.Monoid.Conj"],n["Data.Monoid.Disj"]),a=(n["Data.Monoid.Dual"],n["Data.Monoid.Endo"],n["Data.Monoid.Multiplicative"],n["Data.Semigroup.First"],n["Data.Semigroup.Last"],n.Prelude,function(n,t){this.unwrap=n,this.wrap=t}),o=function(n){return n.wrap},i=function(n){return n.unwrap},u=new a(function(n){return n},e.Disj);t.unwrap=i,t.wrap=o,t.Newtype=a,t.alaF=function(n){return function(t){return function(e){return function(a){return function(u){return function(u){return function(c){return r.map(t)(i(a))(u(r.map(n)(o(e))(c)))}}}}}}},t.newtypeDisj=u}(n["Data.Newtype"]=n["Data.Newtype"]||{}),function(t){"use strict";var r=n["Data.Foldable"],e=(n["Control.Alt"],n["Control.Applicative"]),a=n["Control.Apply"],o=(n["Control.Bind"],n["Control.Category"],n["Control.Plus"],n["Control.Semigroupoid"],n["Data.Eq"],n["Data.Function"],n["Data.Functor"]),i=(n["Data.HeytingAlgebra"],n["Data.Maybe"],n["Data.Maybe.First"],n["Data.Maybe.Last"],n["Data.Monoid"]),u=(n["Data.Monoid.Additive"],n["Data.Monoid.Conj"],n["Data.Monoid.Disj"]),c=(n["Data.Monoid.Dual"],n["Data.Monoid.Endo"],n["Data.Monoid.Multiplicative"],n["Data.Newtype"]),f=(n["Data.Ord"],n["Data.Ordering"],n["Data.Semigroup"]),l=(n["Data.Semiring"],n["Data.Unit"]),s=(n.Prelude,function(n,t,r){this.foldMap=n,this.foldl=t,this.foldr=r}),d=function(n){return n.foldr},p=function(n){return function(t){return function(r){return d(n)(function(n){return function(e){return f.append(t.Semigroup0())(r(n))(e)}})(i.mempty(t))}}},D=new s(function(n){return p(D)(n)},r.foldlArray,r.foldrArray),h=function(n){return n.foldMap};t.Foldable=s,t.foldr=d,t.foldl=function(n){return n.foldl},t.foldMap=h,t.foldMapDefaultR=p,t.traverse_=function(n){return function(t){return function(r){return d(t)(function(t){return a.applySecond(n.Apply0())(r(t))})(e.pure(n)(l.unit))}}},t.any=function(n){return function(t){return c.alaF(o.functorFn)(o.functorFn)(c.newtypeDisj)(c.newtypeDisj)(u.Disj)(h(n)(u.monoidDisj(t)))}},t.foldableArray=D}(n["Data.Foldable"]=n["Data.Foldable"]||{}),function(t){"use strict";n["Control.Applicative"],n["Control.Apply"],n["Control.Biapplicative"],n["Control.Biapply"],n["Control.Bind"],n["Control.Comonad"],n["Control.Extend"],n["Control.Lazy"],n["Control.Monad"],n["Control.Semigroupoid"],n["Data.Bifoldable"],n["Data.Bifunctor"],n["Data.Bitraversable"],n["Data.BooleanAlgebra"],n["Data.Bounded"],n["Data.CommutativeRing"],n["Data.Distributive"],n["Data.Eq"],n["Data.Foldable"],n["Data.FoldableWithIndex"],n["Data.Function"],n["Data.Functor"],n["Data.Functor.Invariant"],n["Data.FunctorWithIndex"],n["Data.HeytingAlgebra"],n["Data.Maybe"],n["Data.Maybe.First"],n["Data.Monoid"],n["Data.Newtype"],n["Data.Ord"],n["Data.Ordering"],n["Data.Ring"],n["Data.Semigroup"],n["Data.Semigroup.Foldable"],n["Data.Semigroup.Traversable"],n["Data.Semiring"],n["Data.Show"],n["Data.Traversable"],n["Data.TraversableWithIndex"],n["Data.Unit"],n.Prelude,n["Type.Equality"];var r=function(){function n(n,t){this.value0=n,this.value1=t}return n.create=function(t){return function(r){return new n(t,r)}},n}();t.Tuple=r}(n["Data.Tuple"]=n["Data.Tuple"]||{}),function(t){"use strict";(n["Partial.Unsafe"]=n["Partial.Unsafe"]||{}).unsafePartial=function(n){return n()}}(),function(t){"use strict";(n["Partial"]=n["Partial"]||{}).crashWith=function(){return function(n){throw new Error(n)}}}(),function(t){"use strict";var r=n.Partial;t.crashWith=r.crashWith}(n.Partial=n.Partial||{}),function(t){"use strict";var r=n["Partial.Unsafe"],e=n.Partial;t.unsafeCrashWith=function(n){return r.unsafePartial(function(t){return e.crashWith(t)(n)})}}(n["Partial.Unsafe"]=n["Partial.Unsafe"]||{}),function(t){"use strict";(n["Unsafe.Coerce"]=n["Unsafe.Coerce"]||{}).unsafeCoerce=function(n){return n}}(),function(t){"use strict";var r=n["Unsafe.Coerce"];t.unsafeCoerce=r.unsafeCoerce}(n["Unsafe.Coerce"]=n["Unsafe.Coerce"]||{}),function(t){"use strict";var r=n["Data.Array"];n["Control.Alt"],n["Control.Alternative"],n["Control.Applicative"],n["Control.Apply"],n["Control.Bind"],n["Control.Category"],n["Control.Lazy"],n["Control.Monad.Rec.Class"],n["Control.Monad.ST"],n["Control.Monad.ST.Internal"],n["Control.Semigroupoid"],n["Data.Array.NonEmpty.Internal"],n["Data.Array.ST"],n["Data.Array.ST.Iterator"],n["Data.Boolean"],n["Data.Eq"],n["Data.Foldable"],n["Data.Function"],n["Data.Functor"],n["Data.HeytingAlgebra"],n["Data.Maybe"],n["Data.Ord"],n["Data.Ordering"],n["Data.Ring"],n["Data.Semigroup"],n["Data.Semiring"],n["Data.Traversable"],n["Data.Tuple"],n["Data.Unfoldable"],n["Partial.Unsafe"],n.Prelude,n["Unsafe.Coerce"];t.mapWithIndex=function(n){return function(t){return r.zipWith(n)(r.range(0)(r.length(t)-1|0))(t)}},t.length=r.length,t.filter=r.filter}(n["Data.Array"]=n["Data.Array"]||{}),function(t){"use strict";n["Control.Alt"];var r=n["Control.Applicative"],e=n["Control.Apply"],a=(n["Control.Bind"],n["Control.Extend"],n["Control.Monad"],n["Control.Semigroupoid"],n["Data.Bifoldable"],n["Data.Bifunctor"],n["Data.Bitraversable"],n["Data.Bounded"],n["Data.Eq"],n["Data.Foldable"],n["Data.FoldableWithIndex"],n["Data.Function"],n["Data.Functor"]),o=(n["Data.Functor.Invariant"],n["Data.FunctorWithIndex"],n["Data.Maybe"],n["Data.Monoid"],n["Data.Ord"],n["Data.Ordering"],n["Data.Semigroup"],n["Data.Show"],n["Data.Traversable"],n["Data.TraversableWithIndex"],n["Data.Unit"],n.Prelude,function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}()),i=function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}(),u=new a.Functor(function(n){return function(t){if(t instanceof o)return new o(t.value0);if(t instanceof i)return new i(n(t.value0));throw new Error("Failed pattern match at Data.Either (line 38, column 8 - line 38, column 52): "+[t.constructor.name])}}),c=new e.Apply(function(){return u},function(n){return function(t){if(n instanceof o)return new o(n.value0);if(n instanceof i)return a.map(u)(n.value0)(t);throw new Error("Failed pattern match at Data.Either (line 82, column 1 - line 82, column 41): "+[n.constructor.name,t.constructor.name])}}),f=new r.Applicative(function(){return c},i.create);t.Left=o,t.Right=i,t.either=function(n){return function(t){return function(r){if(r instanceof o)return n(r.value0);if(r instanceof i)return t(r.value0);throw new Error("Failed pattern match at Data.Either (line 238, column 1 - line 238, column 64): "+[n.constructor.name,t.constructor.name,r.constructor.name])}}},t.functorEither=u,t.applyEither=c,t.applicativeEither=f}(n["Data.Either"]=n["Data.Either"]||{}),function(n){"use strict";n.toCharArray=function(n){return n.split("")},n._charAt=function(n){return function(t){return function(r){return function(e){return r>=0&&r<e.length?n(e.charAt(r)):t}}}},n.length=function(n){return n.length},n._indexOf=function(n){return function(t){return function(r){return function(e){var a=e.indexOf(r);return-1===a?t:n(a)}}}},n._slice=function(n){return function(t){return function(r){return r.slice(n,t)}}}}(n["Data.String.CodeUnits"]=n["Data.String.CodeUnits"]||{}),function(t){"use strict";var r=n["Data.String.CodeUnits"],e=(n["Control.Semigroupoid"],n["Data.Boolean"]),a=(n["Data.Eq"],n["Data.Function"],n["Data.HeytingAlgebra"],n["Data.Maybe"]),o=(n["Data.Ord"],n["Data.Ring"],n["Data.Semiring"],n["Data.String.Pattern"],n["Data.String.Unsafe"],n.Prelude,r._indexOf(a.Just.create)(a.Nothing.value)),i=r._charAt(a.Just.create)(a.Nothing.value);t.charAt=i,t.indexOf=o,t.slice=function(n){return function(t){return function(o){var i=r.length(o),u=function(n){if(n<0)return i+n|0;if(e.otherwise)return n;throw new Error("Failed pattern match at Data.String.CodeUnits (line 314, column 5 - line 315, column 27): "+[n.constructor.name])},c=u(t),f=u(n);return f<0||f>=i||c<0||c>i||f>c?a.Nothing.value:new a.Just(r._slice(n)(t)(o))}}},t.toCharArray=r.toCharArray,t.length=r.length}(n["Data.String.CodeUnits"]=n["Data.String.CodeUnits"]||{}),function(n){"use strict";n.split=function(n){return function(t){return t.split(n)}},n.trim=function(n){return n.trim()}}(n["Data.String.Common"]=n["Data.String.Common"]||{}),function(t){"use strict";var r=n["Data.String.Common"];n["Data.Eq"],n["Data.Ordering"],n["Data.String.Pattern"],n.Prelude;t.split=r.split,t.trim=r.trim}(n["Data.String.Common"]=n["Data.String.Common"]||{}),function(n){"use strict";n.pureE=function(n){return function(){return n}},n.bindE=function(n){return function(t){return function(){return t(n())()}}}}(n.Effect=n.Effect||{}),function(t){"use strict";var r=n.Effect,e=n["Control.Applicative"],a=n["Control.Apply"],o=n["Control.Bind"],i=n["Control.Monad"],u=n["Data.Functor"],c=(n["Data.Monoid"],n["Data.Semigroup"],n.Prelude,new i.Monad(function(){return s},function(){return f})),f=new o.Bind(function(){return l},r.bindE),l=new a.Apply(function(){return d},i.ap(c)),s=new e.Applicative(function(){return l},r.pureE),d=new u.Functor(e.liftA1(s));t.functorEffect=d,t.applyEffect=l,t.applicativeEffect=s,t.bindEffect=f,t.monadEffect=c}(n.Effect=n.Effect||{}),function(n){"use strict";var t=function(){var n={},t="Pure",r="Throw",e="Catch",a="Sync",o="Async",i="Bind",u="Bracket",c="Fork",f="Sequential",l="Map",s="Apply",d="Alt",p="Cons",D="Resume",h="Release",m="Finalizer",g="Finalized",C="Forked";function w(n,t,r,e){this.tag=n,this._1=t,this._2=r,this._3=e}function v(n){var t=function(t,r,e){return new w(n,t,r,e)};return t.tag=n,t}function y(n){return new w(t,void 0)}function A(n){try{n()}catch(t){setTimeout(function(){throw t},0)}}function E(n,t,r){try{return t(r())}catch(e){return n(e)}}function b(n,t,r){try{return t(r)()}catch(e){return r(n(e))(),y}}var S=function(){var n=1024,t=0,r=0,e=new Array(n),a=!1;function o(){var o;for(a=!0;0!==t;)t--,o=e[r],e[r]=void 0,r=(r+1)%n,o();a=!1}return{isDraining:function(){return a},enqueue:function(i){var u;t===n&&(u=a,o(),a=u),e[(r+t)%n]=i,t++,a||o()}}}();var _=0,F=1,M=2,P=3,B=4,U=5,k=6;function R(n,l,s){var d=0,C=_,v=s,y=null,T=null,q=null,L=null,x=null,O=0,j=0,I=null,W=!0;function H(s){for(var j,z,J;;)switch(j=null,z=null,J=null,C){case M:C=F,v=q(v),null===L?q=null:(q=L._1,L=L._2);break;case P:n.isLeft(v)?(C=U,y=v,v=null):null===q?C=U:(C=M,v=n.fromRight(v));break;case F:switch(v.tag){case i:q&&(L=new w(p,q,L)),q=v._2,C=F,v=v._1;break;case t:null===q?(C=U,v=n.right(v._1)):(C=M,v=v._1);break;case a:C=P,v=E(n.left,n.right,v._1);break;case o:return C=B,void(v=b(n.left,v._1,function(n){return function(){d===s&&(d++,S.enqueue(function(){d===s+1&&(C=P,v=n,H(d))}))}}));case r:C=U,y=n.left(v._1),v=null;break;case e:x=new w(p,v,null===q?x:new w(p,new w(D,q,L),x,T),T),q=null,L=null,C=F,v=v._1;break;case u:O++,x=new w(p,v,null===q?x:new w(p,new w(D,q,L),x,T),T),q=null,L=null,C=F,v=v._1;break;case c:C=P,j=R(n,l,v._2),l&&l.register(j),v._1&&j.run(),v=n.right(j);break;case f:C=F,v=N(n,l,v._1)}break;case U:if(q=null,L=null,null===x)C=k,v=T||y||v;else switch(j=x._3,J=x._1,x=x._2,J.tag){case e:T&&T!==j?C=U:y&&(C=F,v=J._2(n.fromLeft(y)),y=null);break;case D:T&&T!==j||y?C=U:(q=J._1,L=J._2,C=M,v=n.fromRight(v));break;case u:O--,null===y&&(z=n.fromRight(v),x=new w(p,new w(h,J._2,z),x,j),(T===j||O>0)&&(C=F,v=J._3(z)));break;case h:O++,x=new w(p,new w(g,v,y),x,T),C=F,v=T&&T!==j?J._1.killed(n.fromLeft(T))(J._2):y?J._1.failed(n.fromLeft(y))(J._2):J._1.completed(n.fromRight(v))(J._2),y=null;break;case m:O++,x=new w(p,new w(g,v,y),x,T),C=F,v=J._1;break;case g:O--,C=U,v=J._1,y=J._2}break;case k:for(var K in I)I.hasOwnProperty(K)&&(W=W&&I[K].rethrow,A(I[K].handler(v)));return I=null,void(T&&y?setTimeout(function(){throw n.fromLeft(y)},0):n.isLeft(v)&&W&&setTimeout(function(){if(W)throw n.fromLeft(v)},0));case _:C=F;break;case B:return}}function z(n){return function(){if(C===k)return W=W&&n.rethrow,n.handler(v)(),function(){};var t=j++;return(I=I||{})[t]=n,function(){null!==I&&delete I[t]}}}return{kill:function(t,r){return function(){if(C===k)return r(n.right(void 0))(),function(){};var e=z({rethrow:!1,handler:function(){return r(n.right(void 0))}})();switch(C){case _:T=n.left(t),C=k,v=T,H(d);break;case B:null===T&&(T=n.left(t)),0===O&&(C===B&&(x=new w(p,new w(m,v(t)),x,T)),C=U,v=null,y=null,H(++d));break;default:null===T&&(T=n.left(t)),0===O&&(C=U,v=null,y=null)}return e}},join:function(n){return function(){var t=z({rethrow:!1,handler:n})();return C===_&&H(d),t}},onComplete:z,isSuspended:function(){return C===_},run:function(){C===_&&(S.isDraining()?H(d):S.enqueue(function(){H(d)}))}}}function T(t,r,e,a){var i=0,u={},c=0,f={},D=new Error("[ParAff] Early exit"),h=null,m=n;function g(r,e,a){var o,i,c=e,f=null,D=null,h=0,m={};n:for(;;)switch(o=null,c.tag){case C:if(c._3===n&&(o=u[c._1],m[h++]=o.kill(r,function(n){return function(){0===--h&&a(n)()}})),null===f)break n;c=f._2,null===D?f=null:(f=D._1,D=D._2);break;case l:c=c._2;break;case s:case d:f&&(D=new w(p,f,D)),f=c,c=c._1}if(0===h)a(t.right(void 0))();else for(i=0,o=h;i<o;i++)m[i]=m[i]();return m}function v(r){return function(e){return function(){delete u[r._1],r._3=e,function r(e,o,i){var u,p,m,C,w,v;for(t.isLeft(e)?(u=e,p=null):(p=e,u=null);;){if(m=null,C=null,w=null,v=null,null!==h)return;if(null===o)return void a(u||p)();if(o._3!==n)return;switch(o.tag){case l:null===u?(o._3=t.right(o._1(t.fromRight(p))),p=o._3):o._3=u;break;case s:if(m=o._1._3,C=o._2._3,u){if(o._3=u,w=!0,v=c++,f[v]=g(D,u===m?o._2:o._1,function(){return function(){delete f[v],w?w=!1:null===i?r(u,null,null):r(u,i._1,i._2)}}),w)return void(w=!1)}else{if(m===n||C===n)return;p=t.right(t.fromRight(m)(t.fromRight(C))),o._3=p}break;case d:if(m=o._1._3,C=o._2._3,m===n&&t.isLeft(C)||C===n&&t.isLeft(m))return;if(m!==n&&t.isLeft(m)&&C!==n&&t.isLeft(C))u=p===m?C:m,p=null,o._3=u;else if(o._3=p,w=!0,v=c++,f[v]=g(D,p===m?o._2:o._1,function(){return function(){delete f[v],w?w=!1:null===i?r(p,null,null):r(p,i._1,i._2)}}),w)return void(w=!1)}null===i?o=null:(o=i._1,i=i._2)}}(e,r._2._1,r._2._2)}}}return function(){var a,o,c=F,f=e,D=null,h=null;n:for(;;)switch(a=null,o=null,c){case F:switch(f.tag){case l:D&&(h=new w(p,D,h)),D=new w(l,f._1,n,n),f=f._2;break;case s:D&&(h=new w(p,D,h)),D=new w(s,n,f._2,n),f=f._1;break;case d:D&&(h=new w(p,D,h)),D=new w(d,n,f._2,n),f=f._1;break;default:o=i++,c=U,a=f,f=new w(C,o,new w(p,D,h),n),(a=R(t,r,a)).onComplete({rethrow:!1,handler:v(f)})(),u[o]=a,r&&r.register(a)}break;case U:if(null===D)break n;D._1===n?(D._1=f,c=F,f=D._2,D._2=n):(D._2=f,f=D,null===h?D=null:(D=h._1,h=h._2))}for(m=f,o=0;o<i;o++)u[o].run()}(),function(n){return new w(o,function(r){return function(){return function(n,r){var e;for(var a in h=t.left(n),f)if(f.hasOwnProperty(a))for(a in e=f[a])e.hasOwnProperty(a)&&e[a]();f=null;var i=g(n,m,r);return function(n){return new w(o,function(n){return function(){for(var n in i)i.hasOwnProperty(n)&&i[n]();return y}})}}(n,r)}})}}function N(n,t,r){return new w(o,function(e){return function(){return T(n,t,r,e)}})}return w.EMPTY=n,w.Pure=v(t),w.Throw=v(r),w.Catch=v(e),w.Sync=v(a),w.Async=v(o),w.Bind=v(i),w.Bracket=v(u),w.Fork=v(c),w.Seq=v(f),w.ParMap=v(l),w.ParApply=v(s),w.ParAlt=v(d),w.Fiber=R,w.Supervisor=function(n){var t={},r=0,e=0;return{register:function(n){var a=r++;n.onComplete({rethrow:!0,handler:function(n){return function(){e--,delete t[a]}}}),t[a]=n,e++},isEmpty:function(){return 0===e},killAll:function(o,i){return function(){var u=0,c={};function f(r){c[r]=t[r].kill(o,function(t){return function(){delete c[r],u--,n.isLeft(t)&&n.fromLeft(t)&&setTimeout(function(){throw n.fromLeft(t)},0),0===u&&i()}})()}for(var l in t)t.hasOwnProperty(l)&&(u++,f(l));return t={},r=0,e=0,function(n){return new w(a,function(){for(var n in c)c.hasOwnProperty(n)&&c[n]()})}}}}},w.Scheduler=S,w.nonCanceler=y,w}();n._pure=t.Pure,n._map=function(n){return function(r){return r.tag===t.Pure.tag?t.Pure(n(r._1)):t.Bind(r,function(r){return t.Pure(n(r))})}},n._bind=function(n){return function(r){return t.Bind(n,r)}},n._liftEffect=t.Sync,n._parAffMap=function(n){return function(r){return t.ParMap(n,r)}},n._parAffApply=function(n){return function(r){return t.ParApply(n,r)}},n.makeAff=t.Async,n._makeFiber=function(n,r){return function(){return t.Fiber(n,null,r)}},n._sequential=t.Seq}(n["Effect.Aff"]=n["Effect.Aff"]||{}),function(t){"use strict";n["Control.Category"],n["Control.Monad"],n.Effect;t.liftEffect=function(n){return n.liftEffect},t.MonadEffect=function(n,t){this.Monad0=n,this.liftEffect=t}}(n["Effect.Class"]=n["Effect.Class"]||{}),function(n){"use strict";n.new=function(n){return function(){return{value:n}}},n.read=function(n){return function(){return n.value}},n.write=function(n){return function(t){return function(){return t.value=n,{}}}}}(n["Effect.Ref"]=n["Effect.Ref"]||{}),function(t){"use strict";var r=n["Effect.Ref"];n["Data.Function"],n["Data.Functor"],n.Effect,n.Prelude;t.new=r.new,t.read=r.read,t.write=r.write}(n["Effect.Ref"]=n["Effect.Ref"]||{}),function(t){"use strict";n["Control.Alt"],n["Control.Alternative"],n["Control.Applicative"],n["Control.Apply"],n["Control.Bind"],n["Control.Monad.Cont.Trans"],n["Control.Monad.Except.Trans"],n["Control.Monad.Maybe.Trans"],n["Control.Monad.Reader.Trans"],n["Control.Monad.Writer.Trans"],n["Control.Plus"],n["Control.Semigroupoid"],n["Data.Either"],n["Data.Function"],n["Data.Functor"],n["Data.Functor.Compose"],n["Data.Maybe"],n["Data.Newtype"],n["Data.Unit"],n["Effect.Class"],n["Effect.Ref"],n.Prelude;t.parallel=function(n){return n.parallel},t.sequential=function(n){return n.sequential},t.Parallel=function(n,t,r,e){this.Applicative1=n,this.Monad0=t,this.parallel=r,this.sequential=e}}(n["Control.Parallel.Class"]=n["Control.Parallel.Class"]||{}),function(t){"use strict";n["Control.Alternative"],n["Control.Apply"];var r=n["Control.Category"],e=n["Control.Parallel.Class"],a=(n["Control.Semigroupoid"],n["Data.Foldable"]),o=(n["Data.Traversable"],n.Prelude,function(n){return function(t){return function(r){return function(o){return e.sequential(n)(a.traverse_(n.Applicative1())(t)(function(t){return e.parallel(n)(r(t))})(o))}}}});t.parTraverse_=o,t.parSequence_=function(n){return function(t){return o(n)(t)(r.identity(r.categoryFn))}}}(n["Control.Parallel"]=n["Control.Parallel"]||{}),function(n){"use strict";n.error=function(n){return new Error(n)},n.throwException=function(n){return function(){throw n}}}(n["Effect.Exception"]=n["Effect.Exception"]||{}),function(t){"use strict";var r=n["Effect.Exception"];n["Control.Applicative"],n["Control.Semigroupoid"],n["Data.Either"],n["Data.Functor"],n["Data.Maybe"],n["Data.Show"],n.Effect,n.Prelude;t.throw=function(n){return r.throwException(r.error(n))}}(n["Effect.Exception"]=n["Effect.Exception"]||{}),function(t){"use strict";var r=n["Effect.Aff"],e=(n["Control.Alt"],n["Control.Alternative"],n["Control.Applicative"]),a=n["Control.Apply"],o=n["Control.Bind"],i=(n["Control.Lazy"],n["Control.Monad"]),u=(n["Control.Monad.Error.Class"],n["Control.Monad.Rec.Class"],n["Control.Parallel"]),c=n["Control.Parallel.Class"],f=(n["Control.Plus"],n["Control.Semigroupoid"],n["Data.Either"]),l=n["Data.Foldable"],s=n["Data.Function"],d=(n["Data.Function.Uncurried"],n["Data.Functor"]),p=n["Data.Monoid"],D=(n["Data.Newtype"],n["Data.Semigroup"]),h=(n["Data.Time.Duration"],n["Data.Unit"]),m=n.Effect,g=n["Effect.Class"],C=(n["Effect.Exception"],n["Effect.Unsafe"],n["Partial.Unsafe"]),w=(n.Prelude,n["Unsafe.Coerce"]),v=new d.Functor(r._parAffMap),y=new d.Functor(r._map),A={isLeft:function(n){if(n instanceof f.Left)return!0;if(n instanceof f.Right)return!1;throw new Error("Failed pattern match at Effect.Aff (line 390, column 12 - line 392, column 20): "+[n.constructor.name])},fromLeft:function(n){if(n instanceof f.Left)return n.value0;if(n instanceof f.Right)return C.unsafeCrashWith("unsafeFromLeft: Right");throw new Error("Failed pattern match at Effect.Aff (line 395, column 20 - line 399, column 3): "+[n.constructor.name])},fromRight:function(n){if(n instanceof f.Right)return n.value0;if(n instanceof f.Left)return C.unsafeCrashWith("unsafeFromRight: Left");throw new Error("Failed pattern match at Effect.Aff (line 400, column 21 - line 402, column 31): "+[n.constructor.name])},left:f.Left.create,right:f.Right.create},E=function(n){return function(){var t=function(n){return r._makeFiber(A,n)}(n)();return t.run(),t}},b=new a.Apply(function(){return v},r._parAffApply),S=new i.Monad(function(){return M},function(){return _}),_=new o.Bind(function(){return F},r._bind),F=new a.Apply(function(){return y},i.ap(S)),M=new e.Applicative(function(){return F},r._pure),P=new g.MonadEffect(function(){return S},r._liftEffect),B=new c.Parallel(function(){return U},function(){return S},w.unsafeCoerce,r._sequential),U=new e.Applicative(function(){return b},function(n){return c.parallel(B)(e.pure(M)(n))}),k=new D.Semigroup(function(n){return function(t){return function(r){return u.parSequence_(B)(l.foldableArray)([n(r),t(r)])}}}),R=s.const(e.pure(M)(h.unit)),T=new p.Monoid(function(){return k},R);t.launchAff=E,t.launchAff_=function(n){return d.void(m.functorEffect)(E(n))},t.nonCanceler=R,t.functorAff=y,t.applyAff=F,t.applicativeAff=M,t.bindAff=_,t.monadAff=S,t.monadEffectAff=P,t.functorParAff=v,t.applyParAff=b,t.applicativeParAff=U,t.parallelAff=B,t.semigroupCanceler=k,t.monoidCanceler=T,t.makeAff=r.makeAff}(n["Effect.Aff"]=n["Effect.Aff"]||{}),function(t){"use strict";n["Node.Encoding"];var r=n["Data.Show"],e=(n.Prelude,function(){function n(){}return n.value=new n,n}()),a=function(){function n(){}return n.value=new n,n}(),o=function(){function n(){}return n.value=new n,n}(),i=function(){function n(){}return n.value=new n,n}(),u=function(){function n(){}return n.value=new n,n}(),c=function(){function n(){}return n.value=new n,n}(),f=function(){function n(){}return n.value=new n,n}(),l=function(){function n(){}return n.value=new n,n}(),s=new r.Show(function(n){if(n instanceof e)return"ASCII";if(n instanceof a)return"UTF8";if(n instanceof o)return"UTF16LE";if(n instanceof i)return"UCS2";if(n instanceof u)return"Base64";if(n instanceof c)return"Latin1";if(n instanceof f)return"Binary";if(n instanceof l)return"Hex";throw new Error("Failed pattern match at Node.Encoding (line 19, column 1 - line 19, column 39): "+[n.constructor.name])});t.ASCII=e,t.UTF8=a,t.UTF16LE=o,t.UCS2=i,t.Base64=u,t.Latin1=c,t.Binary=f,t.Hex=l,t.encodingToNode=function(n){if(n instanceof e)return"ascii";if(n instanceof a)return"utf8";if(n instanceof o)return"utf16le";if(n instanceof i)return"ucs2";if(n instanceof u)return"base64";if(n instanceof c)return"latin1";if(n instanceof f)return"binary";if(n instanceof l)return"hex";throw new Error("Failed pattern match at Node.Encoding (line 31, column 1 - line 31, column 37): "+[n.constructor.name])},t.showEncoding=s}(n["Node.Encoding"]=n["Node.Encoding"]||{}),function(t){"use strict";(n["Node.Process"]=n["Node.Process"]||{}).process=process}(),function(n){"use strict";n.readChunkImpl=function(n){return function(t){return function(r){if(r instanceof Buffer)return t(r);if("string"==typeof r)return n(r);throw new Error("Node.Stream.readChunkImpl: Unrecognised chunk type; expected String or Buffer, got: "+r)}}},n.onDataEitherImpl=function(n){return function(t){return function(r){return function(){t.on("data",function(t){r(n(t))()})}}}},n.onEnd=function(n){return function(t){return function(){n.on("end",t)}}},n.write=function(n){return function(t){return function(r){return function(){return n.write(t,null,r)}}}},n.writeStringImpl=function(n){return function(t){return function(r){return function(e){return function(){return n.write(r,t,e)}}}}}}(n["Node.Stream"]=n["Node.Stream"]||{}),function(t){"use strict";(n["Node.Buffer"]=n["Node.Buffer"]||{}).toStringImpl=function(n){return function(t){return function(){return t.toString(n)}}}}(),function(t){"use strict";var r=n["Node.Buffer"],e=(n["Control.Semigroupoid"],n["Data.ArrayBuffer.Types"],n["Data.Maybe"],n["Data.Show"],n.Effect,n["Node.Encoding"]);n.Prelude;t.toString=function(n){return r.toStringImpl(e.encodingToNode(n))}}(n["Node.Buffer"]=n["Node.Buffer"]||{}),function(t){"use strict";var r=n["Node.Stream"],e=n["Control.Applicative"],a=n["Control.Bind"],o=n["Data.Either"],i=(n["Data.Functor"],n["Data.Maybe"],n["Data.Show"]),u=n.Effect,c=n["Effect.Exception"],f=n["Node.Buffer"],l=n["Node.Encoding"],s=(n.Prelude,r.readChunkImpl(o.Left.create)(o.Right.create)),d=function(n){return function(t){return r.onDataEitherImpl(s)(n)(t)}},p=function(n){return function(t){return d(n)(a.composeKleisliFlipped(u.bindEffect)(t)(function(n){if(n instanceof o.Left)return c.throw("Stream encoding should not be set");if(n instanceof o.Right)return e.pure(u.applicativeEffect)(n.value0);throw new Error("Failed pattern match at Node.Stream (line 94, column 5 - line 98, column 17): "+[n.constructor.name])}))}};t.onData=p,t.onDataString=function(n){return function(t){return function(r){return p(n)(a.composeKleisliFlipped(u.bindEffect)(r)(f.toString(t)))}}},t.onDataEither=d,t.writeString=function(n){return function(t){return r.writeStringImpl(n)(i.show(l.showEncoding)(t))}},t.onEnd=r.onEnd}(n["Node.Stream"]=n["Node.Stream"]||{}),function(t){"use strict";var r=n["Node.Process"],e=(n["Data.Functor"],n["Data.Maybe"],n["Data.Posix"],n["Data.Posix.Signal"],n.Effect,n["Foreign.Object"],n["Node.Platform"],n["Node.Stream"],n.Prelude,n["Unsafe.Coerce"],r.process.stdout),a=r.process.stdin;t.stdin=a,t.stdout=e}(n["Node.Process"]=n["Node.Process"]||{}),function(t){"use strict";var r=n["Control.Applicative"],e=n["Control.Bind"],a=n["Control.Category"],o=n["Data.Array"],i=n["Data.Either"],u=n["Data.Eq"],c=n["Data.Foldable"],f=n["Data.Functor"],l=n["Data.HeytingAlgebra"],s=(n["Data.Int"],n["Data.Maybe"]),d=n["Data.Monoid"],p=(n["Data.Ord"],n["Data.Ring"],n["Data.Semigroup"],n["Data.String"],n["Data.String.CodeUnits"]),D=n["Data.String.Common"],h=(n["Data.String.Pattern"],n["Data.Tuple"]),m=n["Data.Unit"],g=n.Effect,C=n["Effect.Aff"],w=n["Effect.Class"],v=n["Effect.Ref"],y=n["Node.Encoding"],A=n["Node.Process"],E=n["Node.Stream"],b=n["Partial.Unsafe"],S=(n.Prelude,function(n){return i.either(function(n){return b.unsafeCrashWith(n)})(a.identity(a.categoryFn))((t=D.trim(n),r.pure(i.applicativeEither)((function(n){var t=s.fromMaybe(0)(p.indexOf("C")(s.fromMaybe("")(p.slice(2)(p.length(n)-1|0)(n)))),r=c.any(c.foldableArray)(l.heytingAlgebraBoolean)(function(n){return 0!==n.value0&&n.value0!==t&&(n.value1<"a"||"z"<n.value1)})(o.mapWithIndex(h.Tuple.create)(p.toCharArray(n))),e=1===o.length(o.filter(u.eq(u.eqChar)("C"))(p.toCharArray(s.fromMaybe("")(p.slice(2)(p.length(n)-1|0)(n)))));return u.eq(s.eqMaybe(u.eqChar))(p.charAt(0)(n))(new s.Just("A"))&&e&&r}(t)?"AC":"WA")+"\n")));var t}),_=C.makeAff(function(n){return function(){var t=v.new("")();return E.onDataString(A.stdin)(y.UTF8.value)(function(n){return function(){var r=v.read(t)();return v.write(r+n)(t)()}})(),E.onEnd(A.stdin)(function(){var e=v.read(t)();return n(r.pure(i.applicativeEither)(e))()})(),d.mempty(C.monoidCanceler)}}),F=C.launchAff_(e.bind(C.bindAff)(_)(function(n){return e.bind(C.bindAff)(r.pure(C.applicativeAff)(S(n)))(function(n){return w.liftEffect(C.monadEffectAff)((t=n,f.void(g.functorEffect)(E.writeString(A.stdout)(y.UTF8.value)(t)(r.pure(g.applicativeEffect)(m.unit)))));var t})}));t.main=F,t.solve=S}(n.ABC104B=n.ABC104B||{}),n.ABC104B.main();
},{}]},{},["Focm"], null)