显示原始代码
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
int N;
char S[500001], T[500001][500001];
bool c1(char T[]) {
if (!strcmp(S, T))
return true;
else
return false;
}
bool c2(char T[]) {
int lenT = strlen(T), lenS = strlen(S);
if (strlen(T) != strlen(S) + 1)
return false;
int i = 0, j = 0, ct = 0;
for (i = 0; i < lenS; i++) {
while (j < lenT) {
if (S[i] == T[j]) {
ct++;
j++;
break;
}
j++;
}
}
if (ct == lenS)
return true;
else
return false;
}
bool c3(char T[]) {
int lenT = strlen(T), lenS = strlen(S);
if (strlen(S) != strlen(T) + 1)
return false;
int i = 0, j = 0, ct = 0;
for (i = 0; i < lenT; i++) {
while (j < lenS) {
if (T[i] == S[j]) {
ct++;
j++;
break;
}
j++;
}
}
if (ct == lenT)
return true;
else
return false;
}
bool c4(char T[]) {
int lenS = strlen(S);
if (strlen(S) != strlen(T))
return false;
int i, ct = 0;
for (i = 0; i < lenS; i++) {
if (S[i] == T[i]) {
ct++;
}
}
if (ct == lenS - 1)
return true;
else
return false;
}
int main() {
int i, j = 0, ct = 0, days[500001];
scanf("%d %s", &N, S);
for (i = 0; i < N; i++) {
scanf("%s", T[i]);
}
for (i = 0; i < N; ++i) {
if (c1(T[i]) == true) {
ct++;
days[j++] = i + 1;
}
if (c2(T[i])) {
ct++;
days[j++] = i + 1;
}
if (c3(T[i])) {
ct++;
days[j++] = i + 1;
}
if (c4(T[i])) {
ct++;
days[j++] = i + 1;
}
}
printf("%d\n", ct);
for (i = 0; i < ct; i++) {
printf("%d ", days[i]);
}
return 0;
}