How do i count the amount of letters from a word that is from a Queue?
<p>So I am given a problem in which i have to find the specific amount of letters in a word that is from a queue, for example an apple has 2  letter p's, so i would have to print out e.g "The total amount of letters in the word that start with p:2". After that, i have no idea how to print out and count the specific letters. My teacher has recommended me to use the arraylist method to count the letters, but i still do not know how to do it. Forgive me if my codes look messy, i am still quite new to programming.
Here are some of my codes so far:</p>

<pre><code>package fruits;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.*;

public class Fruits {

    public static void main(String[] args) {
        Queue myQueue = new Queue(80);
        for (int j = 0; j &lt; num; j++) {
            System.out.println("Enter the fruits you like to eat" + j + ":");
            String input = sc.nextLine();
            myQueue.enqueue(input);//enqueue the fruits

        }
        System.out.println("List of Fruits i like to eat: ");                     
        for (int x = 0; x &lt; num; x++) {
            System.out.print(x);
            if (!myQueue.isEmpty()) {
                String input = (String) myQueue.dequeue();
                System.out.println(input);
            }
        }

        ArrayList&lt;Queue&gt; list = new ArrayList&lt;Queue&gt;();
        list.add(myQueue);
        System.out.println("Fruits that start with a letter p:");
    }
}
</code></pre>