function out = tossgame()
 %A wins with HTH, B wins with THT
 % out = 1 if A wins the game; else out = 2;
 countA = 0; countB = 0; 
 b3 = toss(); b3 = strcat(b3, toss());
 b3 = strcat(b3,toss());
 while ~strcmp(b3,'HTH') & ~strcmp(b3,'THT')
     b = toss();
     b3 = strcat(b3(2:3),b);
 end;
 if strcmp(b3,'HTH') out= 1;
 else out = 2;
 end;
