题解 | #格式化输出#
格式化输出
https://www.nowcoder.com/practice/d91a06bfaff443928065e611b14a0e95
awk '{
res="";
if ( length($0) <=3 ){
res=$0
}else{
i=length($0)%3
i=i==0?3:i
res=substr($0, 1, i)
for (i=i+1;i+2<=length($0);i+=3) res=res","substr($0, i, 3);
}
print res
}' $1
查看17道真题和解析