Cod sursa(job #2734939)

Utilizator Casian_doispeChiriac Casian Casian_doispe Data 1 aprilie 2021 17:40:41
Problema Trapez Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.71 kb
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>

#define MOD 1000000007

using namespace std;

///ifstream cin ("bignum.in") ;
///ofstream cout("bignum.out") ;

string a ;

vector<string> v ;

int main()
{

    getline(cin, a) ;

    char *ptr = strtok(&a[0], " ") ;

    while(ptr)
    {

        if(!(isdigit(ptr[0])))v.push_back(ptr) ;

        ptr = strtok(0, " ") ;

    }

    sort(v.begin(), v.end()) ;

    int i = 0 ;

    for(int f = 0 ; f < v.size() ; f ++)
    {

        for(int e = 0 ; e < v[f].size() ; e ++)
            a[i ++] = v[f][e] ;

        a[i ++] = ' ' ;

    }

    a[i] = 0 ;

    cout << a ;

    return 0 ;

}