Advertisement
Guest User

Problem : Hello World

a guest
Aug 11th, 2014
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. PROBLEM :
  2. Bob is a newbie to programming and while learning the programming language he came to came the following rules:
  3.  
  4. 1. Each program must start with '{' and will end with '}'.
  5. 2. Each program must contain only one main program. Main program will start with '<' and will end with '>'.
  6. 3. A program may or may not contain user defined fuctions but there is no limitation about the number of user definded functions present in the program. User defined program will start with '(' and will end with ')'.
  7. 4. loops are allowed only inside the functions (this function can be either main function or user defined function(s)). Every loop will start wih '{' and will end with '}'.
  8. 5. User defined function(s) are not allowed to define inside main function or user defined function(s).
  9. 6. Nested loops (loop inside a loop) are allowed.
  10. 7. Instructions can be defined any where inside the program.
  11.  
  12. If any of the above conditions does not met, then the program will generate compilation errors. Today Bob has written his first program "Hello World", but he is not sure about the correctness of the program now your task is to help him to find out whether his program will compile without any errors or not.
  13.  
  14. Input Format:
  15.  
  16. Each Input will contain a single line L, where L is a program written by Bob.
  17. Line 1 : L,where L is a single line program written by Bob.
  18.  
  19. Output Format:
  20. Line 1 : For Valid Input,print
  21. “No Compilation Errors“, if there is no compilation error
  22.  
  23. For Invalid Input,print
  24. “Compilation Error“
  25.  
  26. Sample Input and Output :
  27.  
  28. Input Output
  29.  
  30. 1. { < > ( P ) } No Compilation Errors
  31. 2. { < { } > ( { } ) ) Compilation Errors
  32. 3. { ( { } ) } Compilation Errors
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement