|
|
back to boardC++ AC source here (+) Why you don't use C++ & STL? It more effectively then awful pascal !!! #include <iostream.h> #include <ctype.h> #include <stack> using namespace std; stack<char> st; void flush_stack(){ int n = st.size(), i; if (n>0) { for(i=0; i<n; ++i){ cout<<st.top(); st.pop(); } } } int main () { char pch[1];
while (1) { cin.read(pch, 1); if (cin.eof()) break; if (isalpha(*pch)) { st.push(*pch); } else { flush_stack(); cout.write(pch, 1); } } flush_stack(); return 0; } |
|
|