问答题

简答题

写出下列程序的输出结果。#include<stdio.h>voidmain(){charx;intn=0,k=0;while((x=getchar())!=’#’){//运行时输入:athefthethethere#switch(x){case’t’:k++;break;case’h’:if(k==1)k++;break;case’e’:if(k==2)k++;break;default:k=0;}if(k==3)n++;}printf("%d\n",n);}

【参考答案】

4