VER001-"Carbon Atom" Editorial

PROBLEM LINKS contest

DIFFICULTY Easy

PREREQUISITES concept of stack

PROBLEM STATEMENT Given an expression which contain carbon and hydrogen atoms your task is to find total no of carbon atoms in expression if expression is valid.

Quick Explanation According to bracket increase no. of carbon atoms if you find any time parenthesis is not balance break loop and print “INVALID”.

EDITORIALIST’S SOLUTION here