hacker rank 33th java problem solution(JAVA STACK)

33. JAVA STACK



import java.util.*;
class Solution{

public static void main(String []argh)
{
Scanner sc = new Scanner(System.in);

while (sc.hasNext()) {
String input=sc.next();
           
    while(input.length() != (input = input.replaceAll("\\(\\)|\\[\\]|\\{\\}", "")).length());
    System.out.println(input.isEmpty());
}

}
}

Compiler Message
Success
Input (stdin)Download
{}()
({()})
{}(
[]
Expected OutputDownload
true
true
false
true

Comments

This is an excellent post I seen thanks to share it. It is really what I wanted to see hope in future you will continue for sharing such a excellent post. blended call center solutions

Popular posts from this blog

Amazon Web Services

Google Code-In mentorship experience :)

Hacker Rank all java and python problem solutions