QOJ.ac

QOJ

حد الوقت: 10 s حد الذاكرة: 256 MB مجموع النقاط: 100

#23801. 戒指

الإحصائيات

你有 $N$ 枚戒指。每枚戒指上都刻有一個由 $10$ 個大寫英文字母組成的字串。戒指上的字元是以字串首尾相連的形式刻上去的。不需要擔心反向讀取戒指上所刻字串的情況。

給定想要尋找的字串,請撰寫一個程式,求出包含該字串的戒指有幾枚。

輸入格式

輸入由 $2+N$ 行組成。

第 $1$ 行寫有想要尋找的字串,由 $1$ 個以上、$10$ 個以下的大寫英文字母組成。

第 $2$ 行寫有戒指的數量 $N$($1 \le N \le 100$)。

第 $2+i$ 行($1 \le i \le N$)寫有第 $i$ 枚戒指上所刻的由 $10$ 個字元組成的字串。

輸出格式

在 $1$ 行中輸出一個整數,表示包含想要尋找的字串的戒指數量。

範例

輸入格式 1

ABCD
3
ABCDXXXXXX
YYYYABCDXX
DCBAZZZZZZ

輸出格式 1

2

輸入格式 2

XYZ
1
ZAAAAAAAXY

輸出格式 2

1

輸入格式 3

PQR
3
PQRAAAAPQR
BBPQRBBBBB
CCCCCCCCCC

輸出格式 3

2

說明

範例輸入 $2$ 的戒指中包含 $1$ 個字串 XYZ。這是因為戒指上字串的首尾是相連的。

在範例輸入 $3$ 中,第 $1$ 枚戒指包含 $2$ 個字串 PQR,第 $2$ 枚戒指包含 $1$ 個字串 PQR,第 $3$ 枚戒指不包含字串 PQR。因此,包含字串 PQR 的戒指數量為 $2$ 枚。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.