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.