Quantcast
Channel: Forum Pasja Informatyki - Najnowsze pytania bez odpowiedzi
Viewing all articles
Browse latest Browse all 21942

JSPACE - Spacje

$
0
0

Witajcie !

Ma ktoś pomysł dlaczego mój kod jest odrzucany przez sędziego ? 

#include <iostream>
#include <string>
#include <algorithm>
#include <regex>

using namespace std;

string do_replace(string const & in, string const & from, string const & to)
{
    return regex_replace(in, regex(from), to);
}


int main ()
{
    string str;

    getline(cin,str);

    char *znak = new char [str.length() + 1];

    strcpy(znak, str.c_str());


    for (int i=0; i<str.length(); ++i)
    {
        znak[0]=toupper(znak[0]);

        if(znak[i] == ' ')
        {
            znak[i+1]=toupper(znak[i+1]);
        }

        str[i]=znak[i];
    }

    cout<<do_replace(str, "", "")<<endl;

    return 0;
}

 


Viewing all articles
Browse latest Browse all 21942