// Arup Guha
// 11/13/2015
// Solution to UCF 1987 HS Contest Problem: Mind Your P's and Q's

import java.util.*;

public class pandq {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		while (stdin.hasNext()) {

			String line = stdin.nextLine();
			int p = 0, q = 0;
			for (int i=0; i<line.length(); i++) {
				char c = line.charAt(i);
				if (c == 'P') p++;
				if (c == 'Q') q++;
			}
			System.out.printf("%5d  P'S,%5d  Q'S\n", p, q);
		}
	}
}