Asif loves UAP Programming Contest Club (UPCC). Wherever he goes looks for “UPCC”. One day he met a guy named Mr. Gates, Asif told Mr. Gates that he was tired of looking for “UPCC” manually everywhere and wants an automation system. But Mr. Gates was not a good programmer that’s why he came to you and told you to write a programme which will find out the number of time Asif can make “UPCC” from a Given String. You have to keep in mind that Asif is going to use every character only for once.
.
The first line of the input contains an Integer T (≤ 100) denoting the number of test cases. Each of the next T line consist of a String X (1≤ X ≤ 1000)
For each case print the number of time you can make “UPCC” from X.
Input | Output |
---|---|
3 ABCDEFGHIJKLMNOPQRSTUVCWXYZ BPCCUPCCPU BCUPUUPPPUUUUU | 1 2 0 |
Sequence is not a matter. You just need to see whether the character U,P, C is available in the string or not.