Wrong Answer

seokma97 Reply 9 years 31 weeks ago
#include <stdio.h> int main() { char s1[100]; char s2[50]; char ch; int kk=0,len1,len2,index=0,def=0,result=-1; while ((ch=getchar())!=EOF){ if (kk==0){ if (ch=='\n'){ len1=index; index=0; kk=1; } else s1[index++]=ch; } else if (kk==1){ if (ch=='\n'){ len2=index; kk=2; } else s2[index++]=ch; } if (kk==2) break; } for (int i=0;i<len1;i++){ char ch=s1[i]; if (def==0){ for (int j=0;j<len2;j++){ if (ch==s2[j]){ result=i; def=1; break; } } } else break; } printf("%d",result); return 0; } Wrong Answer이 뜨는 이유를 잘 모르겠습니다!
seokma97 Reply 9 years 31 weeks ago
해결했습니다^^.