import java.util.Scanner;

public class StringLoopingExample {
    
    public static void main(String[] args) {
        Scanner myScanner = new Scanner(System.in);
        
        System.out.println("Please enter the sentence to search in");       
        String sentence = myScanner.nextLine();
        
        System.out.println("Please enter the characters to search for");
        String characters = myScanner.nextLine();
        
        //Loop through the characters we're looking for
        for (int i = 0; i < characters.length(); i++) {
            int foundCharacters = 0;
            char lookingFor = characters.charAt(i);
            
            //Loop through the sentence and check how many times we can find the specific character
            for (int j = 0; j < sentence.length(); j++) {
                if (lookingFor == sentence.charAt(j)) {
                    foundCharacters++;
                }
            }
            
            System.out.println(foundCharacters + " x '" + lookingFor + "'");
        }
        
    }
    
}