// Arup Guha
// 9/17/2013
// Solution to 2012 UCF HS Contest Question: Bacon

import java.util.*;
import java.io.*;

public class bacon {

	public static void main(String[] args) throws Exception {

		Scanner fin = new Scanner(new File("bacon.in"));
		int n = Integer.parseInt(fin.nextLine().trim());

		// Go through each case.
		for (int loop=1; loop<=n; loop++) {
			String line = fin.nextLine();

			// Just look for the next occurrence of the string until none are left.
			int start = 0, cnt = 0;
			while (start < line.length() && line.indexOf("France", start) != -1) {
				start = line.indexOf("France", start) + 1;
				cnt++;
			}

			// Output the result.
			System.out.println("Sentence #"+loop+": "+cnt);
		}

		fin.close();
	}
}