Artifact d8235f29f64235d208760f4a59480ca7a85cb9d1
- File
SRM/424/2A.cpp
- 2011-02-23 09:21:16 - part of checkin [4fd800b3a8] on branch trunk - Copied from private svn repository. (user: kinaba) [annotate]
#include <string>
#include <stack>
using namespace std;
struct MagicSpell
{
string fixTheSpell( string spell )
{
stack<char> s;
for(int i=0; i<spell.size(); ++i)
if( spell[i]=='A' || spell[i]=='Z' )
s.push( spell[i] );
for(int i=0; i<spell.size(); ++i)
if( spell[i]=='A' || spell[i]=='Z' )
spell[i]=s.top(), s.pop();
return spell;
}
};