Problem description A piece of flower cloth, there are some patterns, there is a directly available small bar, there are some patterns. For a given strip of flowers and strips, calculate how many pieces of strips can be cut from the flower cloth?
Input inputs contain some data, respectively, is a pair of flowers and small strips, the cloth is shown with visible ASCII characters, the number of visible ASCII characters, the pattern of the cloth is also how many kinds of patterns. The strips and strips are not more than 1000 characters in length. If you meet the # character, you are no longer working.
Output outputs can be cut from the pattern cloth up to the number of small strips, if not a piece, then honestly output 0, each result should be wrapped.
Sample INPUTABCDE a3aaaaaa aa#
Sample Output03
Authorqianneng
SOURCE Winter Practice Sanjiu II
Recommendlcy | We have carefully selected several similar problems for you:1711 1686 3746 3336 1358 strstr application:
1#include <stdio.h>2#include <iostream>3 using namespacestd;4#include <string.h>5 intMain ()6 {7 Chars[1024x768],a[1024x768];8 while(SCANF ("%s", &s) &&s[0]!='#'&&SCANF ("%s",&a))9 {Ten intCount=0; One Char*p=s; A intlen=strlen (a); - while*pb=strstr (P,a)) { -count++; thep + =Len; - } -cout<<count<<Endl; - } +}
Find application:
1#include <iostream>2#include <stdio.h>3#include <string>4#include <algorithm>5 using namespacestd;6 intMain ()7 {8 stringb;9 intPos,count=0;TenCin>>A; OneCin>>b; A -Pos=a.find (b);//CCABCBBGABCHUHIABC - //cout<<pos<<endl; the while(pos!=-1) - { -count++; -Pos=a.find (b,pos+b.size ()); + - } +cout<<count<<Endl; A return 0; at}
Scissor Strips 2087