프로그래밍 언어 활용난도 중상
3번 · 주관식 · 5점
다음 C 프로그램이 두 번째 문자열에서 정확히 한 번 발견되는 문자를 골라내는 과정을 추적하여 출력 결과를 쓰시오.
#include <stdio.h>
int main(void) {
const char source[] = "sensor";
const char pool[] = "response";
for (int i = 0; source[i] != '\0'; i++) {
int count = 0;
for (int j = 0; pool[j] != '\0'; j++) {
if (source[i] == pool[j]) {
count++;
}
}
if (count == 1) {
putchar(source[i]);
}
}
return 0;
}