File Annotation
Not logged in
4fd800b3a8 2011-02-23        kinaba: #include <string>
4fd800b3a8 2011-02-23        kinaba: #include <stack>
4fd800b3a8 2011-02-23        kinaba: using namespace std;
4fd800b3a8 2011-02-23        kinaba: 
4fd800b3a8 2011-02-23        kinaba: struct MagicSpell
4fd800b3a8 2011-02-23        kinaba: {
4fd800b3a8 2011-02-23        kinaba: 	string fixTheSpell( string spell )
4fd800b3a8 2011-02-23        kinaba: 	{
4fd800b3a8 2011-02-23        kinaba: 		stack<char> s;
4fd800b3a8 2011-02-23        kinaba: 		for(int i=0; i<spell.size(); ++i)
4fd800b3a8 2011-02-23        kinaba: 			if( spell[i]=='A' || spell[i]=='Z' )
4fd800b3a8 2011-02-23        kinaba: 				s.push( spell[i] );
4fd800b3a8 2011-02-23        kinaba: 		for(int i=0; i<spell.size(); ++i)
4fd800b3a8 2011-02-23        kinaba: 			if( spell[i]=='A' || spell[i]=='Z' )
4fd800b3a8 2011-02-23        kinaba: 				spell[i]=s.top(), s.pop();
4fd800b3a8 2011-02-23        kinaba: 		return spell;
4fd800b3a8 2011-02-23        kinaba: 	}
4fd800b3a8 2011-02-23        kinaba: };