package me.yukicoder.wip; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No0495_2 { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input = br.readLine(); int length = input.length(); int cntLeft = 0; int cntRight = 0; String right = "(*^^)"; String left = "(^^*)"; for (int i = 0; i < length - 5; i++) { if (input.substring(i, i + 5).equals(right)) { cntRight++; } else if (input.substring(i, i + 5).equals(left)) { cntLeft++; } } System.out.println(cntLeft + " " + cntRight); } catch (IOException e) { e.printStackTrace(); } } }