MY name is ruhul amin

ISLAMIC UNIVERSITY OF KUSHTIA

Friday, March 29, 2013

code jamer contest problem

#include<iostream>
#include<cstring>
#define max 1000
using namespace std;
int main()
{
    char a[max],b[max];
    int c,la,n,t;
        cin.get(a,max);
        la=strlen(a);
        c=0;
        t=0;
        for(int j=la-1;j>=0;j--)
        {
            if(a[j]==' ')
            {
                for(int k=j+1;k<la-t;k++)
                b[c++]=a[k];
                b[c++]=' ';
                t=c;
            }

        }
        for(int s=0;s<la;s++)
            {
                if(a[s]==' ')
                break;
                else
                b[c++]=a[s];
            }
        cout<<"Case #"<<": "<<b<<endl;
    return 0;
}

No comments:

Post a Comment