Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Reverse polish notation
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//clang 3.8.0 #include <iostream> #define MAX 400 int main() { int top=-1,testCase; char stack[MAX]; std::string cases; std::cin>>testCase; while(testCase--){ std::cin>>cases; for(int i=0;i<cases.length();i++ ) { if(cases[i]==')') { while(stack[top]!='(') { std::cout<<stack[top]; top-=1; } top-=1; } else { if(cases[i] >= 'a' && cases[i]<='z') std::cout<<cases[i]; else { top+=1; stack[top]=cases[i]; } } } std::cout<<std::endl; } return 0; }
clang++
3 (a+(b*c)) ((a+b)*(z+x)) ((a+t)*((b+(a+c))^(c+d)))
Show compiler warnings
[
+
] Compiler args
[
-
]
Show input
Compilation time: 0.62 sec, absolute running time: 0.14 sec, cpu time: 0 sec, memory peak: 3 Mb, absolute service time: 0,76 sec
edit mode
|
history
|
discussion
abc*+ ab+zx+* at+bac++cd+^*