my code is giving correct output but , server tellin output should
start with case #:  , even though my is giving  , my code for reverse
string is :

#include<stdio.h>

#include<string.h>

int main (int argc, const char * argv[]) {
    int n,i,j,count,check=0,end=0;
        int atlast,lastcheckpt,reverseprinting;

        scanf("%d",&n);
                //fflush(stdin);
        char a[n][25];
        for(i=0;i<n+1;i++)
        {
                        gets(a[i]);
        }
        int numbercount=0;
        for(i=0;i<n+1;i++)
        {
                if(numbercount!=0){
                printf("Case #%d: ",numbercount);
                }
                count=(strlen(a[i]));

                lastcheckpt=count;
                for(j=count;j>-1;j--)
                {
                        if(j==0){

                                for(atlast=0;atlast<lastcheckpt;atlast++)
                                {
                                printf("%c",a[i][atlast]);

                                        end=1;

                                }
                        }
                        if(end==1){
                                break;
                        }

                if(a[i][j]==' ')
                {

                        check=j;

                        if(lastcheckpt==count)
                        {

                                
for(reverseprinting=(check+1);reverseprinting<(lastcheckpt
+1);reverseprinting++)
                             {


                        printf("%c",a[i][reverseprinting]);
                        }
                        }
                        else
                        {
                                for(reverseprinting=(check
+1);reverseprinting<(lastcheckpt);reverseprinting++)
                                {
                                        printf("%c",a[i][reverseprinting]);

                                }
                        }

                        printf(" ");


                        lastcheckpt=check;
                }

                }
                end=0;


                printf("\n");
                numbercount++;

        }
}






On Apr 19, 1:37 am, utsav sabharwal <[email protected]> wrote:
> What language are you talking about?
>
>
>
> On Mon, Apr 18, 2011 at 9:58 PM, Luke Pebody <[email protected]> wrote:
> > Slightly cleaner STL version athttp://www.ideone.com/GJgjy.
>
> > On 18 Apr 2011 08:07, "Sakthi Priyan" <[email protected]> wrote:
> >> *C++:*
>
> >> string line = "this is a string", temp;
>
> >> istringstream liness( line );
>
> >> getline( liness, temp, ' ' );
>
> >> vector<string> splittedstrings;
>
> >> while (temp != "")
> >> {
>
> >> splittedstrings.push_back (temp);
>
> >> getline( liness, temp, ' ' );
>
> >> }
>
> >> On Mon, Apr 18, 2011 at 12:22 PM, Vinay Julme <[email protected]>
> >> wrote:
>
> >>> Java:
> >>> String []str = "this is a string".split(" ");
> >>> for(int i = str.length-1; i >=0; i--)
> >>> System.out.println( str[ i ] );
>
> >>> 2011/4/18 João Víctor Rocon Maia <[email protected]>
>
> >>>> Python:
> >>>> tokens = raw_input().split(' ')
> >>>> for i in tokens:
> >>>> print i
>
> >>>> --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups
> >>>> "google-codejam" group.
> >>>> To post to this group, send email to [email protected].
> >>>> To unsubscribe from this group, send email to
> >>>> [email protected].
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/google-code?hl=en.
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "google-codejam" group.
> >>> To post to this group, send email to [email protected].
> >>> To unsubscribe from this group, send email to
> >>> [email protected].
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/google-code?hl=en.
>
> >> --
> >> - Thanks and Regards,
>
> >> *Sakthipriyan*
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "google-codejam" group.
> >> To post to this group, send email to [email protected].
> >> To unsubscribe from this group, send email to
> >> [email protected].
> >> For more options, visit this group at
> >>http://groups.google.com/group/google-code?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "google-codejam" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> >http://groups.google.com/group/google-code?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to