THIS REPO IS YOUR FIRST STEP IN COMPATITVE PROGRAMING WORLD :
By following this repo you will solve all of necomers training and you will improve your problem solving skills.
I solved all those problems by using c++ programing language .
I sorted the repo folders to help you organize your steps .
I impleneted more than one solution in some problems .
i capsulated using functions like this following example:
- solution number 1 π
void solution1()
{
string str, temp;
getline(cin, str);
char ch;
for (int i = 0; i < str.size(); i++)
{
if (str[i] != ' ')
{
temp += str[i];
}
if ((str[i] == ' ' || i == str.size() - 1) && temp.size() != 0)
{
for (int j = 0; j < temp.size() / 2; j++)
{
ch = temp[j];
temp[j] = temp[temp.size() - 1 - j];
temp[temp.size() - 1 - j] = ch;
}
if (i == str.size() - 1)
{
cout << temp;
}
else
{
cout << temp << " ";
}
temp.clear();
}
}
}
- solution number 2 π
void solution2()
{
string str;
bool space = false;
while (cin >> str)
{
reverse(str.begin(), str.end());
if (space)
{
cout << " ";
}
space = true;
cout << str;
}
}
- just call any one of them π
int main()
{
solution2();
}
Mina__Faried
click the icon to contact π :