왜 WA인지 모르겠습니다 한번만 봐주세요

lada74 Reply 9 years 2 weeks ago
제가 테스트해볼땐 분명 잘 되는데.. 왜 안되는지 모르겠습니다ㅠ 아래는 코드입니다. #include<stdio.h> int main() { char ch=0; char buf[200][1000] = {0,}; int i = 0; int j = 0; int k = 0; int cnt = 0; int maxCnt = 0; int maxIndex = 0; do { ch = getchar(); if(ch == '\n' || ch == '\x1a') { buf[i][j] = 0; if(maxCnt < cnt) { maxCnt = cnt; maxIndex = i; } cnt = 0; j = 0; i++; } else { cnt++; buf[i][j++] = ch; } } while(!(ch == EOF || ch == '\x1a')); buf[i][j] = 0; printf("%d\n",maxCnt); for(i = 0; i<maxCnt ; i++) { printf("%c",buf[maxIndex][i]); } printf("\n"); }
persuade Reply 9 years 2 weeks ago
해결하셨군요~
lada74 Reply 9 years 2 weeks ago
감사합니다~