The task is:
Write a function that reads data from standard input until EOF is found and returns the maximum of the real numbers found into the input. We consider a real number as a number composed of two numbers in base-10, joined by a comma. The numbers must be separated from other words by at least one whitespace. All the numbers are guaranteed to be positive and to fit in "unsigned" and "double" data types.


E.g. of valid numbers: 3,14 145,70 0012,34 etc.
I wrote down a plan for this problem but I'm having some problems writing the code:
1. Break the input into words
2. Check that each word has exactly 1 comma (and check that the comma isn't on the first or last position of the word)
3. Check that there are only digits before and after the comma
4. Convert the numbers before the comma into an int (by subtracting '0') // I would also need some help at this step, if you could show me an example of converting for instance the characters 512 into an int I'd be grateful
5. Compare the numbers before comma:
if equal => convert the numbers after the comma into an int and compare them
if also equal => the numbers are equal

I'm having issues with this task because I don't want to use any strings, just getchar(), putchar, ungetc. The first problem I'm encountering is how to actually break the input into words (if I had a string I could just check if(!isspace(s[i]) && isspace(s[i-1] or even easier using strtok) but here it's trickier. Could you give me an idea on how to do this step first?

Code:
#include <stdio.h>
#include <ctype.h>


int main()
{
    int currentChar, lastChar, wordCount = 0, i;
    currentChar = getchar();
    while(currentChar != EOF)
    {
        putchar(currentChar);
        lastChar = currentChar;
        currentChar = getchar();
        if((!isspace(currentChar) && isspace(lastChar)))
        {
            wordCount++;
            //di = currentChar;
        }


    }
    printf("There %d words in the input\n", wordCount);
}
Input:
John has 3 apples
Output:
John has 3 apples
There 4 words in the input