// Arup Guha
// 1/23/2012
// Written in COP 3330 (Stephen Fulwider's Class)
// Counts the number of occurrences of a given letter in a string.

import java.util.*;

public class countletter {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);

		// Get a string (whole line) as input.
		System.out.println("Enter your string.");
		String word = stdin.nextLine();

		// Read in a letter for which to search.
		System.out.println("Enter a letter to search for.");
		char search = stdin.nextLine().charAt(0);

		int count = 0;

		// Go through each letter.
		for (int i=0; i<word.length(); i++) {

			// Add to our count, we found the letter.
			if (word.charAt(i) == search) {
				count++;
			}
		}

		// Print the result.
		System.out.println("Your string had "+count+" copies of the letter "+search);
	}
}