Editorial for Кодирани SMS-и


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.
by: maya

Тестовете можете да видите тук.

Примерно решение на C++:

#include <iostream>
#include <string>
using namespace std;
int main()
{
    string s,s2="";
    cin>>s;

    string s1=s.substr(0,1);
    s2=s1;
    int i=1;
    int n=s.size();

    while (i<n)
    {
        s2=s1+s[i]+s1;
        s1=s2;
        i++;
    }
    cout<<s2<<endl;
    return 0;
}

Comments

There are no comments at the moment.