import java.util.Scanner;
/**
* @Author 陈平安
* @Date 2022/5/1 12:17
* @PackageName:PACKAGE_NAME
* @ClassName: Main
* @Description: TODO
* @Version 1.0
*/
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String string = scanner.nextLine();
int boynum = 0;
int girlnum = 0;
for (int i = 0; i < string.length() - 2; i++) {
if (string.charAt(i) == 'b' || string.charAt(i + 1) == 'o' ||
string.charAt(i + 2) == 'y') {
boynum++;
}
}
for (int i = 0; i < string.length() - 3; i++) {
if (string.charAt(i) == 'g' || string.charAt(i + 1) == 'i' ||
string.charAt(i + 2) == 'r' || string.charAt(i + 3) == 'l') {
girlnum++;
}
}
System.out.println(boynum);
System.out.println(girlnum);
}
}