Untitled
unknown
plain_text
7 months ago
930 B
2
Indexable
Never
#include <stdio.h> #include <stdlib.h> #include <string.h> char input[100]; char word[100][50]; int memeCheck[100]; int main() { int runner=0,w=0,l=0,nowCount=0,maxCount=0,startRun=0,endRun=0,memeRun=0; fgets(input,100,stdin); while (input[runner]!=0){ while(input[runner]!=32){ if(input[runner]==10) break; word[w][l]=input[runner]; runner++; l++; word[w][l]=0; nowCount++; } runner++; w++; l=0; if(nowCount>maxCount) maxCount=nowCount; nowCount=0; } for (int i=0;i<w;i++){ startRun=0; memeCheck[i]=1; for (int j=0;word[i][j]!=0;j++) endRun=j; while(startRun<endRun){ if(word[i][startRun]!=word[i][endRun]){ memeCheck[i]=0; break; } startRun++; endRun--; } } printf("%d\n",w); printf("%d\n",maxCount); while(memeRun<w){ if(memeCheck[memeRun]==1) printf("%s ",word[memeRun]); memeRun++; } return 0; }
Leave a Comment