#include <stdio.h> #include <string.h> int compare(char* pattern,char* string,int n) { int flag=0; int mark=0; for (int i=0;i<strlen(string); i++) { //if(mark==1)break; int v=i; for(int j=0;j<strlen(pattern);j++) { //printf("%s\n",pattern); if(string[v]==pattern[j]) { //printf("i:%d j:%d\n",v,j); if(j!=strlen(pattern)-1)v++; else flag++; } else { mark=1; break; } } } //printf("%d\n",flag); return flag; } void substring(char* pattern,char* string,int n) { if(pattern[0]!='\0') { int num=compare(pattern,string,n); //printf("%d",num); if(num>=2)printf("%s %d\n",pattern,num); } if(n<strlen(string)-1) { //printf("%d\n",n); pattern[n]='0'; substring(pattern, string, n+1); pattern[n]='1'; substring(pattern, string, n+1); } pattern[n]=0; } int main() { char s[100]; char pattern[100]; memset(s,'\0',sizeof(s)); scanf("%s",s); memset(pattern,'\0',sizeof(pattern)); substring(pattern, s,0); }