a game of strings english

1
A game of strings Problem Statement Alice and Bob are now playing with string . Initially they choose a string s and take turn to reduce it. In each turn one of them reduce ascii value of any one character by 1. For example d becomes c, c becomes b and so on. The one who is unable to make a move loses the game. Given a string you need to tell who will win. Alice always moves first. Note: you cannot reduce 'a'. Input Format First line contains a single integer T which denotes number of test cases . Each of the Next T lines contains a String. Output Format For every test case in Newline Output 'Bob' if Bob wins otherwise output 'Alice'. Constraints 1<=Length of each string<=1000 1<=T<=100 Strings will only consist lower case letters. Sample Input 3 ab abb hackerrank Sample Output Alice Bob Bob Explanation In first case Alice will reduce the string to 'aa', then Bob will have no move left. In second case, Alice have to reduce the string to "aba" or "aab". In either case she will lose as Bob will reduce it to "aaa" in his turn.

Upload: harsh-agarwal

Post on 14-Dec-2015

212 views

Category:

Documents


0 download

DESCRIPTION

asas

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.