
#include <string>
#include <vector>
using namespace std;
int solution(string t, string p) {
int answer = 0;
string sub;
for (int i = 0; i < t.size()-p.size()+1; i++)
{
sub = t.substr(i, p.size());
if (p >= sub)
answer++;
}
return answer;
}
지정한 문자열 시작 위치부터 특정 문자 수까지의 부분 문자열을 리턴한다.
substr(size_type offset = 0, size_type count = npos)
// substr(시작 인덱스, 문자 개수)
참고
https://learn.microsoft.com/ko-kr/cpp/assembler/masm/substr?view=msvc-170
https://modoocode.com/235