After some time I realised that I'd misunderstood the question and this misunderstanding was because I did not fully understand the mechanism of getchar() and putchar() functions. At first I thought I had to take the whole string and then itearte through it. But then I understood that "while ((input_char = getchar()) != EOF)" does some kind of iteration (maybe a simulation of iteration, don't know for sure). After that the rest is just a normal logic. When you look at the code you'll probably notice that I did not use if-else pattern. That's simply because "If" is the only thing that I've got so far and I should not use anything else that I know from other programming languages(although I'm sure if-else is found in any language). We have not seen &&,||,boolean either. And also I used ++counter instead of counter++. That's also because we have not yet come to post increment. I know it's the simplest logic that everyone knows but I wanted to share anyway.
#include <stdio.h>
int main()
{
int input_char;
int counter = 0;
while ((input_char = getchar()) != EOF)
{
if (input_char == ' ')
{
++counter;
if (counter == 1)
putchar(input_char);
}
if (input_char != ' ')
{
putchar(input_char);
counter = 0;
}
}
return 0;
}