This is a bit like homework, so I will try to express what I mean in words rather than complete code.
No need to use an array, just use Queue<T> Class directly, please take a look at Queue<T>.Enqueue(T) Method.
There is no need to reuse the same code to remind the user and get the input, put it in a while loop, the loop condition is the magic number.
After the loop is over, you can use linq to get the head and tail elements and other required information, for example:
var re = myQueue.Where(x => x == "t").Count();// re = 3
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.