Solution - UVa Problem 483 - Word Scramble



সল্যুশন্সঃ
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main()
{
    char s[1000];
    int l,b,i;
    while(gets(s))
    {
        l=strlen(s);
        b=-1;
        for(i=0; i<l; i++)
        {
            if(s[i] == ' ')
            {
                for(int j=i-1; j>b; j--)
                {
                    cout << s[j];
                }
                cout << " ";
                b=i;
            }
        }
        for(int j=l-1; j>b; j--)
        {
            cout << s[j];
        }
        cout << endl;
    }

    return 0;
}

আলোচনাঃ
ইজি প্রবলেম। কিন্তু আমার একটু সময় লাগছে :(

Comments

Popular posts from this blog

Solution - Codeforces Problem 327B - Hungry Sequence

Solution - Timus Problem 1293. Eniya

Solution - Timus Problem 1409. Two Gangsters