var input_data = '';
process.stdin.on('data',function(chunk){
input_data += chunk;
});
process.stdin.on('end',function(){
input_data = input_data.split('\n');
let test_case = parseInt(input_data[0]),iteration=1,exprsn,stack,loop,count,char;
while(iteration<=test_case){
exprsn = input_data[iteration];
stack = [];count = 0;
if(exprsn[0] == '>') console.log(0);
else{
for(loop = 0;loop<exprsn.length;loop++){
if(exprsn[loop] == '<') stack.push('<'); //pushing < to stack
else{
if(stack.length === 0) break;
char = stack.pop(); //popping from stack if found >
if(char == '<') count = count + 2;
}
}
console.log(count);
}
iteration++;
}
});
As I am passing the mentioned sample test cases, can anyone help me out to know for which test cases my program is failing?