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

Can I use "gets(str)"?
Posted by Mickkie 26 Dec 2012 20:28
Because the input info states that "The single line of the input contains a sequence" ...
The "Single" line
but I got #1WA

here's my code:
#include<stdio.h>
char str[10005],output[85],temp;
int i,ptr;
main()
{
      /*
      while (scanf("%c",&temp)!=EOF)
      {
            if (temp >= 32)
               str[i++]=temp;
      }
      */
      gets(str);

      for (i=0;str[i];i++)
      {
          if (str[i]=='>')
          {
             if (output[ptr]!=0)
             {
                ptr++;
                if (ptr==80)
                   ptr=0;
             }
          }

          else if (str[i]=='<')
          {
               if (ptr>0)
                  ptr--;
          }

          else
          {
              output[ptr]=str[i];
              ptr++;

              if (ptr==80)
                 ptr=0;
          }

      }
      printf("%s",output);
      scanf(" ");
}

Where is my mistake?
Thanks :)
Re: Can I use "gets(str)"?
Posted by Oxxxymiron 1 May 2014 04:48
ты строчку длины 85 выводишь