Codeforces 625B War of the Corporations [폭력]
4204 단어 수제codeforces
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
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.
Input
The first line of the input contains the name of AI designed by Gogol, its length doesn't exceed 100 000 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.
Output
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.
Sample test(s)
input
intellect
tell
output
1
input
google
apple
output
0
input
sirisiri
sir
output
2
Note
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".
제목: 첫 번째 열에서 최소한 몇 개의 문자를 #으로 수정해야만 첫 번째 열에 두 번째 열이 포함되지 않습니다.
수제.
AC 코드:
#include
#include
#include
#include
#include
#include
#include
#include
#include
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
BC-Round 3 HDU 4908HDU 4908 제목 링크: 클릭하여 링크 열기 처음에 제목을 봤을 때 제목에 있는 median number의 뜻이 중간의 수인 줄 알았어요.역시 영어는 잘 못해...두 번 냈어요.나중에 경기를 봤을 때 스크...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.