Cod sursa(job #322609)
Utilizator | melnic vlad deeprogress | Data | 9 iunie 2009 13:42:32 |
---|---|---|---|
Problema | Rj | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
# include <fstream.h>
# include <string.h>
ifstream fin("rv.in");
ofstream fout("rv.out");
char a[102];
int n,i,st,dr;
int main()
{
fin.getline(a,100);
i=strlen(a);
dr=i-1;
st=0;
while(st<dr)
{
if(a[st]>a[dr])
fout<<a[st],st++;
else
fout<<a[dr],dr--;
if(a[st]<a[dr])
fout<<a[st],st++;
else
fout<<a[dr],dr--;
}
if(i%2!=0)
fout<<a[st]<<'\n';
else
fout<<'\n';
fin.close();
fout.close();
return 0;
}