UVA11988:

Broken Keyboard (a.k.a. Beiju Text)

#include <iostream>
#include <iterator>
#include <string>
#include <list>

using namespace std;

int main(){
	string s;

	while(cin >> s){
		int len = s.length();

		list<char> list;
		list<char>::iterator it;
		it = lst.end();
	}

	return 0;
}

 int sl=s.size();
    list<char>lst;
    list<char>::iterator it;
    it=lst.end();
    for(int i=0;i<sl;i++)
        if(s[i]=='[') it=lst.begin();
        else if(s[i]==']') it=lst.end();
        else lst.insert(it, s[i]);
    for(it=lst.begin();it!=lst.end();it++)
        cout<<*it;
    cout<<endl; 
[Back to Listing Page]

Home

Posts

Projects

Github

Contact

janzzen

Developed by Janzzen Ang powered by Vercel