Ignore leading and trailing whitespace when counting characters