|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1.5 초||1536 MB||35||7||7||87.500%|
Do you know Just Odd Inventions Co., Ltd? The bussiness of this company is doing “just odd inventions.” Here we shall abbreviate its name, and call it the JOI Company.
Recently, the JOI Company is faced with a serious decline in its profitability by doing just odd inventions only. It is planning to start a new business. The plan is to sell liquid containing RNA chains. An RNA chain is considered as a string consisting of 4 characters ‘A’, ‘G’, ‘C’, ‘U’. For its business, the JOI Company prepares N chains of RNA.
The JOI Company will accept an order of RNA chains from customers in the following form:
How many RNA chains prepared by the JOI Company match the conditions of orders from customers?
Given the information on RNA chains prepared by the JOI Company and orders from customers, write a program which calculates the number of RNA chains prepared by the JOI Company which match the conditions of orders from customers.
Read the following data from the standard input.
The output consists of M lines. The j-th line (1 ≤ j ≤ M) contains an integer, the number of RNA chains prepared by the JOI Company which match the condition of the j-th order.
All input data satisfy the following conditions.
There are no additional constraints.
2 3 AUGC AGC G C AU C A C
0 1 2
In this sample input, the JOI Company prepares two RNA chains AUGC, AGC.
3 3 AA AA AGA AA AA AG GA AG GA
2 1 1
Note that the same RNA chains and/or the same orders can appear more than once. Also, there can be an overlap between the first characters and the last characters chosen for an order. For example, the RNA chain AGA is considered as a string whose first characters are AG and last characters are GA.
8 7 GCGCUACCCCAACACAAGGCAAGAUAUA G GGAC GCGG U GCGCUACCCCAACACAAGGCAAGAUGGUC GCCG GCGCUGA GCGCUACCC A GCGCUACCCC AC GCG C GCGC A G G G C G GGA
1 0 1 2 3 2 0