Cody

Solution 1693134

Submitted on 15 Dec 2018 by William
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
s='iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj qqqqqqqqqqqqqnnnnnnnnnnnnnnnnnnnnnnnnnlllllllllllllllhhhhhhhhhhhhhhhhhh ssssvxxxxbbb uuuuuuuuuuuuuuuuuutttttttttttttttttttttttttffffffffffffffffffffffffffffff uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu gggwwwwwwwrrrrrraaaaoooooooppppppyyyyyyyeeeeeeeccccccccccdddddddmmmmmmmzzzzzzkkkk uuuuuuuuuuuuuuuuuuuuuuuuuuuuu'; Vexp=1440; val=train(s); assert(isequal(Vexp,val))

2   Pass
s='ffvvuaaaaddbbbkzzz yynnneerrrxxxx iiiiiwqssssyy mmmmmmmmmggggggggg llltttpjjhhoo'; Vexp=24; val=train(s); assert(isequal(Vexp,val))

3   Pass
s='sssssssssssssssssss wwuuunnnmmgggggpzz kkkhhhdddjjqfxxaaye ttttttt oooooooooooooooooooo'; Vexp=120; val=train(s); assert(isequal(Vexp,val))

4   Pass
s='ssssssssssssssssssss zzkkkkkeuuiii gyyynnffpooxhhhjtt lllllllcccc dddddddwwwwwmmmaaa cccbbbrrrrrrrrrr'; Vexp=120; val=train(s); assert(isequal(Vexp,val))

5   Pass
s='uueeennnbbdjjxx oooooooogg sssssaaaaaww iiiiiiiiiiiii yyssss iiiirrrryyyyy ggghhhfiii kkkqqqqzzzzzzzmmmm pppppppppccccc'; Vexp=24; val=train(s); assert(isequal(Vexp,val))

6   Pass
s='aaaaabbbbcccdddddeeefffffffggggghhiiijjjkkkkklllllmmmmnnnoooopppqqqqrrrsssstttttttuuuuuvvvwwwxyyzzza'; Vexp=0; val=train(s); assert(isequal(Vexp,val))

7   Pass
s='wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww wwww sssssssssssssssssssssssssssssssssssssssssssss hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh llllpppppppppeeeeeeejjjjjjjmmmmoooggkkkkdddddbbbxxxxxfffffffvvvvtttaazzzzzzuuuuuuuuucc wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii wwwwwwwwwwwwwwwwwyyyyyyyyyyyyyyyyyyyyyyyyyyyyyynnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnniiiiiiiiiiiiiii'; Vexp=1440; val=train(s); assert(isequal(Vexp,val))

8   Pass
s='cd bc ab'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

9   Pass
s='ggggggggggggggg hhhhwzziiiiyyyyaaaa gggggggggg bbbbbbbbbbbbbb spjttfllllnncqr kkkkkdddddeeeeevvvvv ggggggg mmmmmmmmmmmmm gggggggggggg'; Vexp=17280; val=train(s); assert(isequal(Vexp,val))

10   Pass
s='iilhzzattttdddjjkk wwwwwwwww uuuuuuiiiiiiiiii fggbn xxxxxxxxxxmmmmm'; Vexp=24; val=train(s); assert(isequal(Vexp,val))

11   Pass
s='tttvvsqqrrrriicccc aaaaaaaaaaaaaaaaaa ggggggggggxxxxxxxxx hheefyyydd zzzzzzzznnnnllllmmmm wwuuuk jjjjj ddddddppppppppp mmmmmmmooooooooo pppppbbbbbbbjjjjjjjj'; Vexp=720; val=train(s); assert(isequal(Vexp,val))

12   Pass
s='nnrrsssplye iggwwwwnnnn'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

13   Pass
s='mmmmmmmmmmmmmmmmmmmmmddddddddddddddddd mmmmmmmmmmmmmmmmmmmmm ddddddddddddddjjjjjjjjjjjjjjrrrrrrrrrrrrrrrrrrrrrrttttttttttttttttt ttttzzzzzzzzvvvvvvvvhhhhhhhhccccllllllllyyyyyyaaaaeeeeeeeeiiiiiiiiii iiiiiiiiwwwwwwwooooooooppppkkkkk'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

14   Pass
s='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ttttttttttttttttttttllllllllllllllllllllllllllllccccccccccccccccccccccccccccooooooooooooooooooooooo iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisssssssssssssssssssssssssssssss bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb gggggxxxxxxrrrrnnnnnnnnmmmmkkkkuuuuuuuuyyyyyhhheeeezzzzffffffffjjjvvvvv bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb qqqqqqqqqqqqqqqqqqqqqqqqqqqqqaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ppppppppppppppppppppppppwwwwwwwwwwwwwwwwwwwwwwwddddddddddddddddddddddd'; Vexp=17280; val=train(s); assert(isequal(Vexp,val))

15   Pass
s='ggggpttt iiiiiiiiii iiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiii fffffffffkkkkkkkkkaa vwwnjssbbbhxxxqqr lllllccccmmuuuuu iiiiiiiiiiiiiiii iiiii'; Vexp=14400; val=train(s); assert(isequal(Vexp,val))

16   Pass
s='kavdczugmoesxvalrdmkcpowwxcnhumcfkzakzbdftweqhxmcfrkziqbyoeziuvitserfjiggoubonggswxlkpkoundgmayxiapv'; Vexp=0; val=train(s); assert(isequal(Vexp,val))

17   Pass
s='abc'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

18   Pass
s='iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii mmmmmmmmmmmmmmvvvvvvvvvvvvvvvvrrrrrrrrrrrruuuuuuuuuuuuuuussssssssssssssssssnnnnnnnnn ffffkwweeebbbbccctttppjjjggggggaaaayyddddddxxxxxx hhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhh iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiihhhhhhhhhhhhhhh'; Vexp=12; val=train(s); assert(isequal(Vexp,val))

19   Pass
s='cclevhhpn ywuuccc'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

20   Pass
s='jjjjjjjjjjhhhhhllllllltttttmmmmmmmmmkkkkkkoooyyyyyyyyyyyycccccnnnnzzzzzzssssssbbbbbbbbbbgggggggg uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwweeeeeeeeeeeeeeeeeeee rrrrrrrrrrrrrrrrrrrrrraaaaaaaaaaaaaaaaaaaaaaaaaaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq eeeeeeeeeeeeddddddddddddqqqqqqqqqqqqqqqq uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu'; Vexp=24; val=train(s); assert(isequal(Vexp,val))

21   Pass
s='yyxxxmmmmhhhhhuuuujjlllllliiiiiieeeccccggbzzzzaaafff wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww vvvvsssssskkkknn rrrrrrrrrrrrrrrrrrrrrqqqqqqqqqqqqqqqqqqqqpppppppppppppppppp ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo tttttttttttttttttttttttttttttttttttttttttttttttttttttt tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt dddddddddddddddddddddddddddddddddddddddddddddddddddddddddd'; Vexp=10080; val=train(s); assert(isequal(Vexp,val))

22   Pass
s='qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr vvvvvjjjjggggggmmmmmlllllppppppppfffffiiiiiiiidddddddeeeezsssssbbbbbbuuuuu qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq'; Vexp=2; val=train(s); assert(isequal(Vexp,val))

23   Pass
s='xxxvvvvaaaaylsqqkg ddcccpttmm nnnnnnnnnnnnnnnnnnn nnnnnnnnnnnnnnnnnnn jjjjjuuuuhhhhhhhh ziiiddddd'; Vexp=48; val=train(s); assert(isequal(Vexp,val))

24   Pass
s='g i uvbm iog k rdi'; Vexp=6; val=train(s); assert(isequal(Vexp,val))

25   Pass
s='ccaallttwniiiiiixxhh rrrrfffffbbeeeuuuuuuuggggggyycccc sssssssssssssssvvvvvvvvvvvvvvrrrrrrrrrrrrrrrrrrr'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

26   Pass
s='rrrrrrkkkkknnnnnnllsssssssssssssscccccccppppppddddddddmmmmmmwwwwwwqqqqqqiiitttttttjjjjjjjjjjj uuuuuuuuurrrrrrrr'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

27   Pass
s='ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh vzaaappssooookkkkyyyyffbbbwwwiiiiiiiirrrllqqqqeexxddnncg mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj'; Vexp=24; val=train(s); assert(isequal(Vexp,val))

28   Pass
s='ccccccccccccccccccccccccccccccccccccccccccccccczzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz wwwwwwwwwwffffffffffffffffppppppppppppppppppccccccccccc'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

29   Pass
s='zzzzzzzzttttttttttthhhhhhhxxxxxxbbbbbbbwwwwwwwyyypppooooorrrnnnnnnuuuggaammmmmkkkkkccccvvvvvllllllll iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss'; Vexp=40320; val=train(s); assert(isequal(Vexp,val))

30   Pass
s='eeeeeeeeeeeeee hhhhhhhh xxxxxxxxxxxxxxxxxxxx iiiaanwwwrrbbbb hhhhhhhuuuuuuuuuuu dddddddtttttttttiiii gggggggggzzzzzzz qqqqccfvvvoyyykjjmm bblllllppppp'; Vexp=720; val=train(s); assert(isequal(Vexp,val))

31   Pass
s='ttttttttttttttttttttttttttttttttttttcccccccccccccccccccccccccccccccccccccccc ttttttttttttttttttttttttttttttttttttttttttttttt ccccccccccccccccccccccccccccccc pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp ppppppppppppppppppppp ccccccccccccccccccccccccccccccccccccccccccc pppppppppppppppppppppppppppppppppppppppppppppppppppp pppppppppppppppppppppppppppppppppppppppttttttttttttttttttttttttttttttttttt pppppppppppppppppppppppppppppppppppppp'; Vexp=48; val=train(s); assert(isequal(Vexp,val))

32   Pass
s='abc bcd'; Vexp=0; val=train(s); assert(isequal(Vexp,val))

33   Pass
s='eeeeeeeeeeeeeeaaaaaaaaaaaadddddddddddddddd zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz wwwwwwvvvvvqqqqqqqqyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyylllllllllllllllluuuuuuuuuuuuuuuuuuuuuuuuuzzzzzzzzzzzzzzzzzzzzzzzzzzzz ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff eeeeeeeeeeeeeeeeeeeee rrrrrrrrrrrrrrrrkkkkkkkkkkkkkkkkkkkkkkkk dnnnnnnnnnpppppxxxxxxffffffff'; Vexp=6; val=train(s); assert(isequal(Vexp,val))

34   Pass
s='mmmmmmmffffffffffffkkkkkkkkkkkkkkkkkkkdddddddddddddd oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooommmmmmmmmmmmmmmmmmmmmmm'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

35   Pass
s='eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeennnnnnnnnnnnnnnnnnnnnnnnnnnnnn nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'; Vexp=720; val=train(s); assert(isequal(Vexp,val))

36   Pass
s='ggggggggqqqffffffmmmiiiiiiiuuuuuuueeeeeeyyyyyyddddddddkkkkkkvvvvvvvrrrrppllllllllbbbbbwwwwwwwwjjjjjj xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhzzzzzzzzzzzzzzzzzzzzzzzzzz aaaaaaaaaaaaaaaaaaaaaaaaaaaaaassssssssssssssssssssssstttttttttttttttttttttttnnnnnnnnnnnnnnnnnnnnnn'; Vexp=6; val=train(s); assert(isequal(Vexp,val))

37   Pass
s='bbbbbuuuuussfffffvvvkkhhheeeyyyyyjjqqqqqnnn ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd llllllllllllllllllllllllllllllllllllllllwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww ggggggmmmmmmmmmmmmiiiiiiiiiaaaaaxxxxxxxxzzzzzzzzzzzooooooooo'; Vexp=24; val=train(s); assert(isequal(Vexp,val))

38   Pass
s='bbbbbbbbbbbbbbbbrrrrrrrrrrrrrrrrrrvvvvvvvvvvvvvvvvvvvvssssssssssssssssssssswwwwwwwwwwwwwwlllllllll uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu qqq yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyykkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk cccccccccoooooppppppppppppppjjjjjjjjjjjqqqqqq kkehhhhxxxftiiib qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqddddddddddddddddddddddddddddnnnnnnnnnnnnnnnnnnnnnnnnnnnnn uuuuuuuuuuuuuuuuuuuuuuuuuuuuuccccccccccccccccccccccccccccc nnnnnnnnnnnnnnnnnnnnnnnnnnnnmmmmmmmmmmmmmmmmmmmmmggggggggggggggggyyyyyyyyyyyyyyyyyyyyyyyyyy'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

39   Pass
s='jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjggggggggggggggggggggggggggggggggggaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa hhhhhhhhhhhhhhh zzzzzzzzzzzzzzzzzzzzvvvvvvvvvvvvvvvvuuuuuuuuuuuuuuuuuuuuuuuupppppppppppppooooooooooooooooooooooo hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhh iiiiiiiiiiiiiiiiiiiiiiiiiiiiinnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnneeeeeeeeeeeeeeeeeeeeeeeeeeeeeee hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh wwwwccccffffrrqqqqqqbbttttttdddddddxxxllllllllllyyyyyyyymmmmmmkkkkkksssssss'; Vexp=86400; val=train(s); assert(isequal(Vexp,val))

40   Pass
s='uuuuuuuyyyyyddddddddqqqqqttttttbbbiiiiiiiaaahhh ooooooooogggggguuuuuuuuuu'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

41   Pass
s='ggggggoooooeeeyjjqqqqqqq mmmmmttttddddddrrraaaaaaaaallllllllzzzzzzzzzzzznnnnnnnnnnnnnnwwwwwwwggggg'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

42   Pass
s='kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx eeeeeaaaaaaaaaawwwwwwwwwwwwzzzzzzzzzzzzzsssssssssssssssqqqqqqqqyyyyyyyyyyyyyyyvvvvvvvvvvvvvvffff dddddddddddddddddddddddddddddddddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh jjjjjjjjjjjllllllllllllllllllloooooooooooooooooooooooooocccccccccccccccccccrrrrrrrrrrrrrrrrrrrr ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg'; Vexp=120; val=train(s); assert(isequal(Vexp,val))

43   Pass
s='aa aa bc'; Vexp=4; val=train(s); assert(isequal(Vexp,val))

44   Pass
s='kkkkkkrrynnn vvvvvvvvvvvvvvvvvvvv jhhppibllllddddaooff nqqqwwwwwsss xmmmmmmmtttucc zzzzzzzzzzzzzzzzzzzz eeeeeeeeeeeee'; Vexp=720; val=train(s); assert(isequal(Vexp,val))

45   Pass
s='fffffffffffffffffffffffffffffffffffffffffffffffffffffeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ccccccccccccccccccccccccccccccc ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyygggggggggggggggggggggggggggggggggggg sssssssshhhhhhhhhhhhhhhhzzzzzzzzzzzzzooo nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnssssssssssssssssssssssssssssssssssssssssssssssss sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss jjjjjxxxxrrriiitttttttwwwwpppppkddddddddqqqqaaaaallllllvvbbuuuuummmm nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn'; Vexp=120; val=train(s); assert(isequal(Vexp,val))

46   Pass
s='yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuukkkkkkkkkkkkkkkkkkk xxxxxxxxxxxxxvvvvvvvvvvvvvveeeeeeeeeeeeeeeeeegggggggggggg mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm ppppppppwwwwwwwiiiiiiiiiqqqqqsssaaaaaaaaalllllllllttttnnnnnnnddddddddhhhhhhhjjjjjjjrrrrroooooooo kkkkkkkkkkkkkkkkkkkkkkk zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzyyyyy cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk'; Vexp=240; val=train(s); assert(isequal(Vexp,val))

47   Pass
s='rrrrrrrbbbbbbbbb sslll rrrrsss mmmmmmddddd lllllllooo ooooooommmm'; Vexp=0; val=train(s); assert(isequal(Vexp,val))

48   Pass
s='eeeeeeeeeeeeeeeeee xxmmmmm rrrrrrrrrrrrrr iiiii hhgdddfccbbqqqnniii ppppppppppppppp aayyyy oooooooooooooooooooo wwvsssszzzkkttllljjj uuuuuuuuuuuuuuuu'; Vexp=362880; val=train(s); assert(isequal(Vexp,val))

49   Pass
s='jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj jjjj'; Vexp=6; val=train(s); assert(isequal(Vexp,val))

50   Pass
s='xxxxxxxx xxxxxxx iiavvvvppjjnnnzzzr gkkkuuwwsscccmmmmeed hhhqqqqqqqqqoooooo llllllllxxxxxxx bbyyttttttffffff'; Vexp=240; val=train(s); assert(isequal(Vexp,val))

51   Pass
s='kkkkddddmmccssbb ppppppppppppp rryyyyyyqiiezzuhhx wwwwwwwwww ppppppppp aaaaaaooooooooo jjjjjjjjjjjjjjjjjjj ffffffffffffffffffff ggggggggvvvvvvtttttt lllllllnnnnnnnnnnnnn'; Vexp=725760; val=train(s); assert(isequal(Vexp,val))

52   Pass
s='aaaaaaaaaaaaaaaaaaavvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvqqqqqqqqqqqqqqqkkkkkkkkkmmmmmmmmmm mmmppppppppppppppxxxxxxxxxxxxxxxxxxxxcccccccccyyyyyyyyyyyyyyeeeeeeeeeeeeehhhhhhhhh'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

53   Pass
s='zzzzzzzzzccccccccccchhhhhhhhhhffffffffffdddddddddaaaaaaaaavvvvvvvvvvvvvv rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrpppppppppppppmmmmmkkkkkkkkkkooooooooonnnnnnnntttttteeeeeellllljjj'; Vexp=2; val=train(s); assert(isequal(Vexp,val))

54   Pass
s='zzzzzzzzzzzzzzzzz nnnffooqqqsdeeegrrmm hhhhhhhhhcccccccccc wwwwwwwwwwuuuuuuuuuu jlllkkkx cccccaaaaapppijjjjj bbbbhhhhhhhhhhhhhh yyyyyyyvvvvvvvvvvvv'; Vexp=120; val=train(s); assert(isequal(Vexp,val))

55   Pass
s='ccccccccccccccc bbbbbbbbbwwwwwwww lllllllllllll peezzzuuiisoodtttfff mmmmmmmmmmmmmmmmm qqqyyyyyyyyyrr'; Vexp=720; val=train(s); assert(isequal(Vexp,val))

56   Pass
s='tqqxvveggggccdda oooott'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

57   Pass
s='qqqqwwooooommhhhhhhhhlllllllsssssddddnnnniiiiiexxxxxxxxxttttffyyyyyyyybbbbbccggggggkkkkk qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

58   Pass
s='cccccccccccccccfffffffffffffffffffffggggggggggggmmmmmmmmmmmmmmmmmmoooooooooooqqqqqqqqqqqqq uuuuuuuuuuuuuuuuuuuuuuubbbbbbbbbbbbbjjjjjjjjjjjjjdddddddddddddddddd qqqqqqqqqqqqnnnnnnnnnnnnnnnnnnnnnkkkkkkkkkkkkkkkkkkkkkkk kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkttttttttttttttttttttttttttttttttttttttaaaaaaaaaaaaaaaaaaaaaaaaaa'; Vexp=2; val=train(s); assert(isequal(Vexp,val))

59   Pass
s='ccccccccgggggggggggg wwwwww oooooooooo zzzzzzzzzzzzzzz rrttttttfffmm hhhhhhhhhbbbbvvvvvv xxxlnnpssddddijaoo yyyyyyyyyyyyyyyyy'; Vexp=5040; val=train(s); assert(isequal(Vexp,val))

60   Pass
s='p'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

61   Pass
s='qqqgguuuuctmmmmddjor rrrrrrrrrrrrrrrrrr'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

62   Pass
s='ab ab'; Vexp=0; val=train(s); assert(isequal(Vexp,val))

63   Pass
s='qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfffffffffffffffffffffffffffffffffffffffffff rrrrrrllllllllllyyyyyy oooooooooooovvvvvvvvvvvvvvvvvvviiiiiiiwwwwwwwwwwwwwwcccccccccccccc mmmmmmmmmmmmmmmzzzzzkkkkkknnnnnnnnnbbbbbbbbaaaaaaaaaa aaaaaappppppgggggggghhhhhhhhhhhqqqqqqqqqqqqq ttttttttttttttttttjjjjjjjjjjjjjjjjjjjjuuuuuuuuuuuuuuuuuuuuuussssssssssssssssss fffffffeeeeeexxxxxttt yyyyyyyyyyyyyyyyyyyyyyydddddddddddddddmmmmmmmmmmmmmmmmmmmmmm'; Vexp=2; val=train(s); assert(isequal(Vexp,val))

64   Pass
s='uuuucccccccccccxxxxxxxxxxxxxx nnnnnnnnffffflllllllliiiiiiihhhhhhzzzzzzzzzzzzeeeeeeeeeeqqqqqqq kkkkkkkkkkkkkkkggggggggggggggggggggggaaaaaaaaaaaaaaaaaaaaauuuuuuuuuuuuuuuuuuuuuuuuuuu'; Vexp=2; val=train(s); assert(isequal(Vexp,val))

65   Pass
s='nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn hhhhkkkkkkkkkkkkkaaaaaaaoooooommeeeeeevvvvvvvvzzzzxxxxxxxxrrrrrrr lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll ccccccccyyyyyuuuuuuiiqqqqqqqqqqddddddjjjjjtttttttbbbbbffffssssswwwwwwwwwgggppppppp'; Vexp=24; val=train(s); assert(isequal(Vexp,val))

66   Pass
s='mmmmmmiiiii cccccccccccccccccccc hhhhhhhhhhhhhhhhh aooryzzkvvvblffff cccccccpppppqqqqq'; Vexp=24; val=train(s); assert(isequal(Vexp,val))

67   Pass
s='cccccccccc ccjjill'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

68   Pass
s='dddrrnnnnnj pppppvvvvmmmmmmoo ttttttttttttttt jjjjjjjjiiiiiiiii uullwaaaagykxxxxbe iiiiiiiiiiizzzzzzz ffffffffffssssssss'; Vexp=120; val=train(s); assert(isequal(Vexp,val))

69   Pass
s='abc a a'; Vexp=2; val=train(s); assert(isequal(Vexp,val))

70   Pass
s='qqeebbccggy uuuuufff snittojvwwwpx ddddaaaaaaaammmmmmm rrrrrrrrrrrr fffllllllhhzzzddddd'; Vexp=24; val=train(s); assert(isequal(Vexp,val))

71   Pass
s='nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn gggggooojjjuuuummmmrrrrrttppppwwwwwaaaaaahhhhhhfffffkkkbbbbccccceeeezzzvvv nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn nnnnnnnnnnnnnnnnnnnnnnn nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn nnnnnnnnnnnnnnnnnnnnnn nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn nnnnnnnnnnnnnnnnnnnnnnnnnnnnnn'; Vexp=80640; val=train(s); assert(isequal(Vexp,val))

72   Pass
s='eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeezzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz nnnnnnnnnnnnnnnsssssssssssssiiiiiiiiiuuuuuuuuuuuuuuuuu lllllllllllllffffffffffvvvvvvvgggggghhhhhhhh bbbbrrrrrqqqqwwwwmmkkkoooooaaayy hhhhhhhhhhhhhxxxxxxxxxxxxxppppppppppppppppppppptttttttttttttttttteeeeeeee'; Vexp=6; val=train(s); assert(isequal(Vexp,val))

73   Pass
s='gggggggggtttttttqqqqqqxxxxxxxxkkkkkkkkyyyymmmmmmmmmwwwwwwwoooooooooooooeeeeeee pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp ssssssssssssssssssssssssssssssssssssssssssssssssssssssss iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd fffrrraahhhhhlllllccbbbbvvzz jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu'; Vexp=362880; val=train(s); assert(isequal(Vexp,val))

74   Pass
s='wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww xxxxxxxxxxxxxxxxxxxxxxxxxxxooooooooooooooooooooooooooooobbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb fffiiaaauuurrrddeevvvhhhhgqqqcccccnnnpyyyyssmmmmtzkkkk jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll'; Vexp=120; val=train(s); assert(isequal(Vexp,val))

75   Pass
s='a ca a abc'; Vexp=0; val=train(s); assert(isequal(Vexp,val))

76   Pass
s='llllllllllllllllllllllllllllllllaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbfffffffffffffffffffffffffffffffffffllllllllllllll vvvvvvvvvvvvvvvjjjjjjjjjjjjjjjjjjjjooooooooodddddddddddddwwwwwwwwwwwwwwnnnnnnnnnnnnnnnnnnnnn eeeeeeeeeeeeeeeeeeeeeeeeeepppppppppppppppppppp syyyyyyyytthhhccczzzzrrrrrggqqkkkxxuuuummmmmiii ppppppppppppppppppppppppppppppppbbbbbbbbbb'; Vexp=6; val=train(s); assert(isequal(Vexp,val))

77   Pass
s='oooooooooooooooooooooooooooaaaaaaaaaaaaaaaaaaaaaaaaaaiiiiiiiiiiiiiiiiiiiiiiiiiii qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq eekrrrwsnnnngggddxczffmmhhhpvvvvttjlllbbb uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'; Vexp=24; val=train(s); assert(isequal(Vexp,val))

78   Pass
s='vvvvvvvvvvvvvbbbbbbbbbbbbbbbbbbsssssssssssssfffffffffppppppppppppppplllllllllllllllll ttttzzzzzzzzzyyyyyaaaaooooooiiiiiiiiiinnnjjjjjjjjmmmmdddddddgggcccccxxxxxeeeeeeeeeeqqqqqhhhhrrrrrr'; Vexp=2; val=train(s); assert(isequal(Vexp,val))

79   Pass
s='xx fffffrrrrrrrrrrrr xssssttwwwf rrr ffffffffff'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

80   Pass
s='nnnnnnnnnnnnnnnnnnnn ttttttttttt fffffffffffffffffff ffffffffffffffffffff lgggccccbyyy yhaqqqmooo pppkkkeeerrrrrr'; Vexp=240; val=train(s); assert(isequal(Vexp,val))

81   Pass
s='aaabbbbccccdddddeeeeeeeeeffgggghiijjjjkkllllllmmmmnnnnnnnopppqqqqqqqqqrrssssttttuuuuvvwwwxxyyyyyzzzz'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

82   Pass
s='ggggjjdddiiiixxxyyy pppppppppppppp ooooooooooooo lllllllllllll ebshuuuufffmaaawvvv ttttttttttttttt zzzzzzzzzzzzzzzzzz cccccccccccccccccccc ppppppppppppppppppp qqqqqqqqqqq'; Vexp=725760; val=train(s); assert(isequal(Vexp,val))

83   Pass
s='tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt kkiiiillxxxddwwwwmmmfffqqeeuuhhhnnnnsssssbbbbpppjjya'; Vexp=2; val=train(s); assert(isequal(Vexp,val))

84   Pass
s='rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

85   Pass
s='gggggggggggjjjjjjjjjkkkkkktttttttthhhhhyyyyyyyyyyppppppppppaaaafffffffffffffffvvvvvvvrrrrrrrr uuuuuuuuuuuuuqqqqqqqqqbbbbbbbbbbbbdddddddddwwwwwwwwwwwwzzzzzzzxxxxxxxxeeeeeeeeeeeennnnnnnlllllllllll rrrrrrrrrrrrrrrrrrsssssssssssssssmmmmmmmmmmmmmoooooooooooooccccccccccccc'; Vexp=2; val=train(s); assert(isequal(Vexp,val))

86   Pass
s='rrrrrrzzzzzz wwwwwwwwwwwwwwww uuuuuaaaaaa lllllllllllllllll ggggggggiiiiiiiiii hhhhhhhhhhhhhhhhhhhh qqssjjjmmfttecddd bbbbnnvpyyykkkxxoo'; Vexp=40320; val=train(s); assert(isequal(Vexp,val))

87   Pass
s='dddddddddddddddddddddddeeeeeeeeeeeeeeeeeegggggggggjjjjjjjjjjjjjjfffffffffff bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ttttttppppphhaaqqqqqxxxxxiiiiiiuuuuucccccmmmsszzzzznnnnnnn yyyyyyyyyywwwwwwwwwwooooooooooorrrrrrrrrrvvvvvvvvvvvvvvvvvddd kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkklllllllllllllllllllllllllllllllllllllllllllllllllllll'; Vexp=24; val=train(s); assert(isequal(Vexp,val))

88   Pass
s='jw ki ij'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

89   Pass
s='yooccccgdexxmmrz wwwwwaaaiiiiii lllllllllllllllllll bbbbbbbbnnnn llllll ppppppppppppppppppp kkkhhhhhttttttjjj'; Vexp=1440; val=train(s); assert(isequal(Vexp,val))

90   Pass
s='uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuujjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj xxxxxxxxxxxttttttttttttttttaaaaaaaaahhhhhhhhhhhhhhhzzzzzzzzzzzzzzuuuu'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

91   Pass
s='rrrrrpppppppp oooooooooooooooooooo ggqqwwwssmmjjahuun'; Vexp=6; val=train(s); assert(isequal(Vexp,val))

92   Pass
s='yyyyyyyyyyyyyyyyyyyeeeeeeeeeeeeeeeeeeeedddddddddddddddddddrrrrrrrrrrrrr pppppppppppppppppppppppppppppppppppppppppppppppppppppp rrrrrrrrrrrrrrrrrrrrrrrrrvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvzzzzzzzzzzzzzzzzssssssssssssppppppppp xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxooooooooooooooooooooooooooooooooooooooooooooo ppppppppppppppppppp pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp ppppppppppppppppppppppbbbbbbbbbbbbbbbbbbbbbbiiiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxx'; Vexp=6; val=train(s); assert(isequal(Vexp,val))

93   Pass
s='rrrrrrrrrrrrrrrrrrrrrrrrrrrrrcccccccccccccccccccccccc dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb oooooooooooooooooooooooaaaaaaaaaaaaaaaaaa sssgggggggglllllmmmmttttttttttttzzzjjjjjjjpppphhhhhyyyyyiiiiiixxxxxeeekkkkkkkkkfffffffuuuuuuuuwwwwww vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn'; Vexp=5040; val=train(s); assert(isequal(Vexp,val))

94   Pass
s='xxxxxmmmmmwwwwwws yyyyyyqqqqqqqq pppppppppppppppppp llllllllllllllllll vvvvvvvvvvvvvvvvv eeeeeeeeeeeeeeeeeee aaaaaaaaaaaaaaa ggggggggggggggggggg shhhodrrruuutt'; Vexp=40320; val=train(s); assert(isequal(Vexp,val))

95   Pass
s='kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj nnnnnnnnnggggggggmmmmmmmaaaaaattttttttttttwwwwwwwweeeeeeeeuuuuuuuuqqqqqqfffffffooooooo zzzzzzzzddddddddddvvvvvvv pppppppxxxxxxxxxxxxxrrrrrrrrrriiiiiiiiiiiiiikkkkkkk ppppppppppppppppppppppppppppppppppppppppppppp yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv hhhhhhhhhhhhhhhhhhhhhbbbbbbbbbbbbbbbbbbbbbbppppppppppppppppppppppppp'; Vexp=2; val=train(s); assert(isequal(Vexp,val))

96   Pass
s='cccccccccccc qqqqqqqqqqqqqqqqq rrrrrr yyyyyyyyyyyyyyyy mmmmmmmmmmmmmmmmmmmm rrrrrrrrrrrrrr tttpajjibbuuuzfooo dddddddddddddd ssssswwhhheeelnnkkk rrrrrrrrrr'; Vexp=241920; val=train(s); assert(isequal(Vexp,val))

97   Pass
s='uummmmslzaaaddprqqqq kkffff jjjjjjjjjjjjjjjj kkkkkkkkkkkkk kkkkkkkkkkkkkkkkkkk'; Vexp=12; val=train(s); assert(isequal(Vexp,val))

98   Pass
s='zzzzzyyyyyy nnoooooalllkkswwwf fch'; Vexp=2; val=train(s); assert(isequal(Vexp,val))

99   Pass
s='sssssssssssssssssssssssssssssssssssssssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ttttttttttttttttttss'; Vexp=1; val=train(s); assert(isequal(Vexp,val))

100   Pass
s='fffffffffffffffffffffffffffffffffffff fffffffoooooosssssssssssdddddddddddddddiiiiiiiiiiiiiiiiiiyyyyyyyyyyyyyyyyyyyyyzzzz zzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'; Vexp=4; val=train(s); assert(isequal(Vexp,val))

101   Pass
% Full GJam solution % function GJam_Rd1c_bv2 % % % trial = 1; % if trial == 1 % fin = 'B-small-practice.in'; % fout = 'B-small-practice2.out'; % elseif trial == 2 % fin = 'B-small-attempt0.in'; % fout = 'B-small-attempt0.out'; % elseif trial == 3 % fin = 'B-large-attempt0.in'; % fout = 'B-large-attempt0.out'; % elseif trial == 4 % fin = 'B-small-practice_tiny.in'; % fout = 'B-small-practice_tiny1.out'; % elseif trial == 5 % fin = 'B-large-practice.in'; % fout = 'B-large-practice.out'; % end % % [data] = read_file(fin); % % % fidG = fopen(fout, 'w'); % % tic % for i=1:size(data,2) % Cell array has N cols of cases % % val=train(data{i}); % %toc % fprintf('Case #%i: %i\n',i,val); % fprintf(fidG,'Case #%i: %i\n',i,val); % % % end % toc % % fclose(fidG); % end % % function val=train(s) % val=0; % % vstr=regexp(s,' ','split'); % % N=size(vstr,2); % % % create vs, ve, vinternal % % check if internals % vc=zeros(1,255); % common vector for overlaps % % for i=1:N % find starts/ends % s1=double(vstr{i}); % vs(i)=s1(1); % ve(i)=s1(end); % vc(vs(i))=1; % vc(ve(i))=1; % end % % for i=1:N % v=double(vstr{i}); % % [valid,vint]=check_vint(v); % % if ~valid,return;end % if any(vc(vint)),return;end % internal elsewhere or internal to a start/end % vc(vint)=1; % % end % i % % m=[vs' ve']; % % m=sortrows(m,[1 2]); % sort start then ends within start % % N=size(m,1); % % if two pices have same start or end and neither is an aa then Invalid % for c=1:2 % for i=1:N-1 % if m(i,1)==m(i,2),continue;end % schk=m(i,c); % for j=i+1:N % if m(j,1)==m(j,2),continue;end % if schk==m(j,c),return;end % end % j % end % i % end % c % % % Cases are valid, at least a 1 % %Q is PI(Ni!) for the i cases of aaa, bbb,... % %val=Q*Z! where Z is number of independent groups % % val=1; % % Zptr=N; % % % Aptr Zptr remove aa pairs and multiply by perms of aa sets % while Zptr>1 % Aptr=Zptr; % if m(Zptr,1)==m(Zptr,2) % valid aa event % qp=1; % while m(Aptr-1,1)==m(Aptr-1,2) && m(Aptr-1,1)==m(Zptr,1) % Aptr=Aptr-1; % qp=qp+1; % if Aptr==1,break;end % finished off the pairs % end % val=val*factorial(qp); % m(Aptr+1:Zptr,:)=[]; % end % Zptr=Aptr-1; % end % Zptr % % % reduce m of aa if ba or ca % N=size(m,1); % for i=N:-1:2 % if m(i,1)==m(i,2) % if any(sum(m==m(i,1))>1) % m(i,:)=[]; % end % end % end % % N=size(m,1); % for i=N:-1:1 % z{i}=m(i,:); % end % % % % Create blocks ab bc cd ef fg gh to abcd efgh or ad eh final m rows ! % mb=m*0; % % create strings adn then check if valid, ab ba is a 0 by abba or baab % % check_vint % while ~isequal(mb,m) % mb=m; % N=size(m,1); % iptr=N; % while iptr>1 % ptr=find(m(1:iptr-1,1)==m(iptr,2),1,'first'); % check end to starts % if ~isempty(ptr) % m(ptr,1)=m(iptr,1); % m(iptr,:)=[]; % z{ptr}=[z{iptr} z{ptr}]; % z(iptr)=[]; % else % checkstart to ends % ptr=find(m(1:iptr-1,2)==m(iptr,1),1,'first'); % check start to ends % if ~isempty(ptr) % start to end % m(ptr,2)=m(iptr,2); % m(iptr,:)=[]; % z{ptr}=[z{ptr} z{iptr}]; % z(iptr)=[]; % end % end % iptr=iptr-1; % end % while iptr % % end % mb m % % % for i=1:size(z,2) % [valid,vint]=check_vint(z{i}); % if ~valid % val=0; % return; % end % end % %m % % N=size(m,1); % % val=val*factorial(N); % % end % % function [valid,vint]=check_vint(v) % % create list of internal elements, may be empty set % % check if v is self consistent % % abbbc becomes abc; aabbcc abc % valid=0; % % dv=diff(v); % dv(dv==0)=[]; % remove dupes % vp=cumsum([v(1) dv]); % % if length(vp)>2 % vint=vp(2:end-1); % else % vint=[]; % end % % if length(vp)==length(unique(vp)) % valid=1; % end % % end % % % function [d] = read_file(fn) % % Output d{} string of strings separated by a space % d={}; % fid=fopen(fn); % fgetl(fid); % Total Count ignore % ptr=0; % while ~feof(fid) % fgetl(fid); % skip % ptr=ptr+1; % d{ptr}=fgetl(fid); % end % feof % fclose(fid); % % end % read_file