int state =0;
while(state<9)
{
switch state{
case 0:
if(ch=='f'){
state=1;getchar(ch);
}
case 1:
if(ch=='o'){
state=2;getchar(ch);
}else reporterror();
case 2:
if(ch=='r'){
state=3;getchar(ch);
}else reporterror();
case 3:
if(ch=='('){
state=4;getchar(ch);
}else reporterror();
case 4:
if(ch==')'){
state=5;getchar(ch);
}else getchar(ch);
case 5:
switch ch{
case '{':getchar(ch);state=6;
default:;
}
case 6:
if(ch=='}'){
state=9;
}
}
}