printf("nn[Extension Goal]n");
b = strtok(str, " ");
for (int i = 0; b != NULL;i++) {
strcpy(a[i], b);
b = strtok(NULL, " ,.");
}
int c = wordCnt + 1;
for (int i = 0; i < c; i++) {
int count = 1;
int cnt = 0;
for (int j = i + 1; j < c; j++) {
if (strcmp(a[i], a[j]) == 0)
count += 1;
}
if (i == 0)
printf("%s : %dn", a[i], count);
else if (i >= 1) {
for (int k = i - 1; k >= 0; k--) {
if (strcmp(a[i], a[k]) == 0)
cnt += 1;
}
if (cnt == 0)
printf("%s : %dn", a[i], count);
}
}
return wordCnt + 1;
}
tolower했는데 안 되더라고요
이 코드에서는 char str[1000]={0} 에 입력받은 걸 쓰는 건데
입력받는 건 문장이예요
b = strtok(str, " ");
for (int i = 0; b != NULL;i++) {
strcpy(a[i], b);
b = strtok(NULL, " ,.");
}
int c = wordCnt + 1;
for (int i = 0; i < c; i++) {
int count = 1;
int cnt = 0;
for (int j = i + 1; j < c; j++) {
if (strcmp(a[i], a[j]) == 0)
count += 1;
}
if (i == 0)
printf("%s : %dn", a[i], count);
else if (i >= 1) {
for (int k = i - 1; k >= 0; k--) {
if (strcmp(a[i], a[k]) == 0)
cnt += 1;
}
if (cnt == 0)
printf("%s : %dn", a[i], count);
}
}
return wordCnt + 1;
}
tolower했는데 안 되더라고요
이 코드에서는 char str[1000]={0} 에 입력받은 걸 쓰는 건데
입력받는 건 문장이예요
(char)&(0xDF)
(char)|(0x20) 이구나