Transcript
Page 1: A Game of Strings English

AgameofstringsProblemStatement

AliceandBobarenowplayingwithstring.Initiallytheychooseastringsandtaketurntoreduceit.Ineachturnoneofthemreduceasciivalueofanyonecharacterby1.Forexampledbecomesc,cbecomesbandsoon.Theonewhoisunabletomakeamovelosesthegame.Givenastringyouneedtotellwhowillwin.Alicealwaysmovesfirst.

Note:youcannotreduce'a'.

InputFormat

FirstlinecontainsasingleintegerTwhichdenotesnumberoftestcases.EachoftheNextTlinescontainsaString.

OutputFormatForeverytestcaseinNewlineOutput'Bob'ifBobwinsotherwiseoutput'Alice'.

Constraints

1<=Lengthofeachstring<=10001<=T<=100Stringswillonlyconsistlowercaseletters.

SampleInput

3ababbhackerrank

SampleOutput

AliceBobBob

Explanation

InfirstcaseAlicewillreducethestringto'aa',thenBobwillhavenomoveleft.

Insecondcase,Alicehavetoreducethestringto"aba"or"aab".IneithercaseshewillloseasBobwillreduceitto"aaa"inhisturn.

Top Related