Is there another logic for this purpose: Read through an input file for tags ex: <html> </html> <head> </head>
and check if the other half of the pair is also present. If <html> is there, its other half< /html> should also be present. If not report an error message stating which tag is missing. For this question, I'm thinking to apply the following logic.
Read throught the file till I get a '<' then put that whole tag like<head> in a stack and when I find the other half pop it from the stack.
Is there a better, less strain logical way to to perform this application.