303210: CF625B. War of the Corporations

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

War of the Corporations

题意翻译

很久以前,在一个遥远的星系中,两个巨大的IT公司 Pineapple 和 Gogol 在激烈的竞争。关键时刻,Gogol 准备发布它的新平板电脑 Lastus 3000。 这款新设备配备了专门设计的人工智能,Pineapple 公司的员工尽最大努力推迟 Lastus 3000 的发布时间。最后,他们发现,新的人工智能的名称与 Pineapple 公司200年前发布的手机的名称相似。由于其名称的所有权利属于 Pineapple 公司,他们坚持要改变 Gogol 人工智能的名称。 Pineapple 公司坚持认为,他们的手机名称作为一个子串出现在人工智能的名称中。由于技术名称已经印在所有设备上,Gogol 的负责人决定,用 `#` 替换人工智能名称中的一些字符。由于这个操作相当昂贵,你应该找到最少的字符数来替换 `#`,使得 AI 的名字的子串不会包含手机的名字。 子串指的是字符串的连续子序列。 Translated by @Z_LOVE_OI

题目描述

A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000. This new device is equipped with specially designed artificial intelligence (AI). Employees of Pineapple did their best to postpone the release of Lastus 3000 as long as possible. Finally, they found out, that the name of the new artificial intelligence is similar to the name of the phone, that Pineapple released 200 years ago. As all rights on its name belong to Pineapple, they stand on changing the name of Gogol's artificial intelligence. Pineapple insists, that the name of their phone occurs in the name of AI as a substring. Because the name of technology was already printed on all devices, the Gogol's director decided to replace some characters in AI name with "\#". As this operation is pretty expensive, you should find the minimum number of characters to replace with "\#", such that the name of AI doesn't contain the name of the phone as a substring. Substring is a continuous subsequence of a string.

输入输出格式

输入格式


The first line of the input contains the name of AI designed by Gogol, its length doesn't exceed $ 100000 $ characters. Second line contains the name of the phone released by Pineapple 200 years ago, its length doesn't exceed $ 30 $ . Both string are non-empty and consist of only small English letters.

输出格式


Print the minimum number of characters that must be replaced with "\#" in order to obtain that the name of the phone doesn't occur in the name of AI as a substring.

输入输出样例

输入样例 #1

intellect
tell

输出样例 #1

1

输入样例 #2

google
apple

输出样例 #2

0

输入样例 #3

sirisiri
sir

输出样例 #3

2

说明

In the first sample AI's name may be replaced with "int#llect". In the second sample Gogol can just keep things as they are. In the third sample one of the new possible names of AI may be "s#ris#ri".

Input

题意翻译

很久以前,在一个遥远的星系中,两个巨大的IT公司 Pineapple 和 Gogol 在激烈的竞争。关键时刻,Gogol 准备发布它的新平板电脑 Lastus 3000。 这款新设备配备了专门设计的人工智能,Pineapple 公司的员工尽最大努力推迟 Lastus 3000 的发布时间。最后,他们发现,新的人工智能的名称与 Pineapple 公司200年前发布的手机的名称相似。由于其名称的所有权利属于 Pineapple 公司,他们坚持要改变 Gogol 人工智能的名称。 Pineapple 公司坚持认为,他们的手机名称作为一个子串出现在人工智能的名称中。由于技术名称已经印在所有设备上,Gogol 的负责人决定,用 `#` 替换人工智能名称中的一些字符。由于这个操作相当昂贵,你应该找到最少的字符数来替换 `#`,使得 AI 的名字的子串不会包含手机的名字。 子串指的是字符串的连续子序列。 Translated by @Z_LOVE_OI

加入题单

算法标签: