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 1226. esreveR redrO

Why WA2???
Posted by sokoL[TSOGU™] 14 Oct 2009 00:01
#include<stdio.h>
#include<iostream>

using namespace std;


char str[300],text[3000005],c,ch;
int n=-1,i=0,cnt=-1;
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif

while(scanf("%c",&c)!=EOF)
{
        n++;
        text[n] = c;

}

            while(i<n)
            {
            memset(str,'\0',sizeof(str));
            cnt= -1;
                while(1)
                {
                        if((text[i]>='a'&&text[i]<='z')||(text[i]>='A'&&text[i]<='Z'))
                        {
                                cnt++;
                                str[cnt] = text[i];
                                i++;
                        }
                        else {
                                ch = text[i];
                                i++;
                                break;
                             }

                }

        for(int j=cnt;j>=0;j--)
        {
         printf("%c",str[j]);
        }


         printf("%c",ch);



                 }
 return 0;
      }
Re: Why WA2???
Posted by Shyu SeiMin 4 Jan 2010 10:41
i WA#2,too.

what's the test?

Edited by author 04.01.2010 10:42