Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Author: 曹北健(37509)
- Result: AC Submission_id: 5340113
- Created at: Thu Apr 06 2023 20:52:50 GMT+0800 (China Standard Time)
- Problem: 6820 Time: 3 Memory: 1556
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <math.h>
- #include <ctype.h>
- #include <time.h>
- #pragma warning(disable:4996 6031)
- int main(){
- #ifdef _DEBUG
- freopen("../../input.txt", "r", stdin);
- #endif // _DEBUG
- char a[512] = { 0 }, b[512] = { 0 };
- gets(a);
- gets(b);
- char *p = a;
- int l = strlen(b);
- for(;;){
- p = strstr(p, b);
- if(p){
- printf("%d-%d\n", p - a, p - a + l - 1);
- p += l;
- }
- else{
- break;
- }
- }
- #ifdef _DEBUG
- freopen("CON", "r", stdin);
- system("pause");
- #endif // _DEBUG
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement