ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1094. E-screen

Why WA
Posted by Alabaster 24 Jun 2002 15:50
// E-screen
#include <iostream.h>

char screen[80];
int cur=0;

void emulate()
{
 char c;
 while (cin.get(c))
 {
  if (c=='<' && cur>0) cur--;
  else if (c=='>')
  {
   if (cur<79) cur++;
   else cur=0;
  }
  else if (c!='\n' && c!='>' && c!='<')
  {
   screen[cur]=c;
   if (cur<79) cur++;
   else cur=0;
  }
 }
 for (cur=0; cur<80; cur++)
  if (screen[cur]!=NULL) cout << screen[cur];
 cout << '\n';
}

int main()
{
 emulate();
 return 0;
}