/*  2007/2008 Southern California Regional
    ACM International Collegiate Programming Contest

    Problem 0  (Sample)
    Rock, Scissors, Paper
    M. K. Furon.                    2007-10-18.                       */




#include   <stdio.h>




int indexa, indexb;
char lineimage[8];
int result[3];
int payoff[3][3]=
{
{0, 1, 2},
{2, 0, 1},
{1, 2, 0}
};




int rpsindex (char play)
{
/*  Return the index into the payoff table for each of Paper, 
    Rock, and Scissors.                                               */

switch (play)
{
case 'P':
   return (0);
   break;
case 'R':
   return (1);
   break;
case 'S':
   return (2);
   break;
default:
   (void) fputs ("Invalid play character.\n", stderr);
}
return (-1);
}




int main (int argc, char *argv[], char *envp[])
{
result[0] = result[1] = result[2] = 0;

/*  For each line, extract the hand signal of each player.  Lookup
    the winner of such a pair in the payoff matrix and increment
    the win counter for that player.  Counter 0 represents draws.     */
while ((fgets (lineimage, 6, stdin)) != NULL)
   {
   indexa = rpsindex (lineimage[0]);
   indexb = rpsindex (lineimage[2]);
   result[(payoff[indexa][indexb])]++;
   }

/*  Print the final results.                                          */
(void) printf ("%d %d %d\n", result[1], result[2], result[0]);
return (0);
}
