Question: USING STDOUT AND STDIN to read .Txt File Mind Your P's and Q's Filename: PANDQ The Problem: Given a list of strings, count the number

USING STDOUT AND STDIN to read .Txt File

Mind Your P's and Q's

Filename: PANDQ

The Problem: Given a list of strings, count the number of occurrences of the letters P and Q in each.

The Input: On each line will be one string, starting in column one. The strings are guaranteed to be between one and seventy characters in length, inclusive. The only characters that will appear in the strings are capital letters.

The Output: For each input string, print the number of P's and Q's, in the following format: n P'S, m Q'S where n is the number of P's, and m is the number of Q's.

Sample Input: GJKRYQRGHBHJBHKOPPUBHJGUG WGYIHIHK PPPPPPPPPQQQQQQQQQQQPPFQQQQ TmSHAsNoNEOFErrHER

Sample Output: 2 P'S, 1 Q'S 12 P'S, 15 Q'S 0 P'S, 0 Q'S

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!