// Arup Guha
// 10/9/2015
// Solution to 2001 UCF HS Contest Problem: Hope Chest Gone Bad

import java.util.*;

public class hope {

	public static ArrayList<Integer> holes;

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();

		// Process each case.
		for (int loop=1; loop<=numCases; loop++) {

			// Read input, store as list of integers with screw holes.
			String str = stdin.next();
			holes = new ArrayList<Integer>();
			for (int i=0; i<str.length(); i++)
				if (str.charAt(i) == 'o')
					holes.add(i);

			// Solve and output (in reverse sorted order).
			int[] res = solve();
			System.out.println("Hope Chest #"+loop+": "+res[1]+" "+res[0]);
		}
	}

	public static int[] solve() {

		// No solution at first.
		int[] resIndex = null;

		// i represents starting index of first hinge.
		for (int i=0; i<holes.size(); i++) {

			// j represents starting index of second hinge.
			for (int j=i+2; j<holes.size()-1; j++) {

				// See if this index wins.
				int[] tmp = {i,j};
				if (beat(tmp, resIndex))
					resIndex = tmp;
			}
		}

		// Create the result and return it, sorted.
		int[] res = { holes.get(resIndex[0]+1)-holes.get(resIndex[0])-1, holes.get(resIndex[1]+1)-holes.get(resIndex[1])-1 };
		Arrays.sort(res);
		return res;
	}

	public static boolean beat(int[] newItem, int[] best) {

		// Avoid null ptr error.
		if (best == null) return true;

		// First total.
		if (totalCovered(newItem) > totalCovered(best)) return true;
		if (totalCovered(newItem) < totalCovered(best)) return false;

		// Then, how far apart.
		if (apart(newItem) > apart(best)) return true;
		if (apart(newItem) < apart(best)) return false;

		// Finally, tie must be broken.
		return largest(newItem)	> largest(best);
	}

	// Returns the total number of holes covered by sol.
	public static int totalCovered(int[] sol) {
		int res = 0;
		for (int i=0; i<sol.length; i++)
			res += (holes.get(sol[i]+1) - holes.get(sol[i]));
		return res;
	}

	// Returns how far apart sol is (its range).
	public static int apart(int[] sol) {
		return holes.get(sol[1]+1) - holes.get(sol[0]);
	}

	// Returns the largest item in sol.
	public static int largest(int[] sol) {
		int res = 0;
		for (int i=0; i<sol.length; i++)
			res = Math.max(res, holes.get(sol[i]+1) - holes.get(sol[i]));
		return res;
	}
}