32 lines
720 B
C
32 lines
720 B
C
#include <stdio.h>
|
|
#include <stdbool.h>
|
|
#include <string.h>
|
|
|
|
bool compareChar(char examinee, char pattern) {
|
|
if(pattern == '?' || pattern == examinee) {
|
|
return true;
|
|
}
|
|
else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
int index = 0, shift = 0;
|
|
bool same = false;
|
|
char sA[31] = {0}, sB[31] = {0};
|
|
scanf("%s", sA);
|
|
scanf("%s", sB);
|
|
for (index = 0; index <= strlen(sA) - strlen(sB); index++) {
|
|
same = true;
|
|
for (shift = 0 ; shift < strlen(sB) && same; shift++) {
|
|
if (!compareChar(sA[index+shift], sB[shift])) {
|
|
same = false;
|
|
}
|
|
}
|
|
if (same) {
|
|
printf("%d ", index);
|
|
}
|
|
}
|
|
return 0;
|
|
} |