如何避免在这个程序中输出前打印空行?

how to avoid the blank line printed before the output in this program?

我的代码如下
如何避免在所需输出之前打印空白行? 问题是打印出最大跑垒数的击球手。

#include<stdio.h>
#include<stdlib.h>
    
    int main()
    {
        int n,runs,maxRuns=0;
        char bat[100],maxBat[100];
        scanf("%d",&n);
        for(int i=0;i<n;i++){
            scanf("%[^,],%d",&bat,&runs);
            if(runs>maxRuns){
                maxRuns=runs;
                strcpy(maxBat,bat);
            }
        }
        printf("%s",maxBat);
    
    }

我得到的输出是

尝试以下方法

scanf( " %[^,],%d", bat, &runs );

看到第一个转换说明符前的空白,

也不要使用 &bat,而是使用 bat,因为表达式 &bat (char( * )[100]) 的类型不是 char *,因为它是转换说明符 %[.