// Arup Guha
// 9/19/2012
// Solution to 2009 MCPC Problem F: Rock, Paper, Scissors

import java.util.*;

public class f {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		String one = stdin.next();
		String two = stdin.next();

		// Go through all cases.
		while (!one.equals("E")) {

			// Simulate each game.
			int p1cnt = 0, p2cnt = 0;
			for (int i=0; i<one.length(); i++) {
				if (beat(one.charAt(i), two.charAt(i)))
					p1cnt++;
				else if (beat(two.charAt(i), one.charAt(i)))
					p2cnt++;
			}

			// Print result.
			System.out.println("P1: "+p1cnt);
			System.out.println("P2: "+p2cnt);

			// Get next case.
			one = stdin.next();
			two = stdin.next();
		}
	}

	// Just do brute force here - 3 ways to win.
	public static boolean beat(char one, char two) {
		if (one == 'R' && two == 'S')
			return true;
		if (one == 'S' && two == 'P')
			return true;
		if (one == 'P' && two == 'R')
			return true;
		return false;
	}
}