How can I count spaces in a long text without an EOL while scanning string literal error