fork download
  1. #include<stdio.h>
  2.  
  3. #include<string.h>
  4. /* A->BC C->+BC/@ B->DE E->*DE/@ D->(A)/i*/
  5. char a,f,a1;
  6. int i=0;//i is the current pointer here
  7. void S();
  8. void A();
  9. void A1();
  10. void main()
  11. {
  12. //clrscr();
  13. //char a;
  14. printf("Enter a character\n");
  15. scanf("%c",&a);
  16. S();
  17. if(f!=1 && a=='$') printf("ACCEPTED");
  18. else printf("NOT ACCEPTED");
  19. //getch();
  20. }
  21. void S()
  22. {
  23. if(a=='c')
  24. {
  25. printf("Entered c \n");
  26. scanf("%c",&a);
  27. A();
  28.  
  29. if(a=='d')
  30. {
  31. printf("Enter\n");
  32. scanf("%c",&a);
  33. }
  34. else
  35. f=1;
  36. }
  37. if(a=='b')
  38. {
  39. printf("Enter\n");
  40. scanf("%c",&a);
  41. if(a=='d')
  42. { printf("Enter\n");
  43. scanf("%c",&a);
  44. }
  45. else f=1;
  46. }
  47. }
  48. void A()
  49. {
  50. if(a=='a')
  51. {
  52. printf("Enter\n");
  53. scanf("%c",&a);
  54. A1();
  55. }
  56. }
  57. void A1()
  58. {
  59. if(a=='b')
  60. {
  61. printf("Enter\n");
  62. scanf("%c",&a);
  63. }
  64. }
  65.  
Runtime error #stdin #stdout 0s 2172KB
stdin
a
stdout
Enter a character
NOT ACCEPTED