题解 | #格式化输出#

格式化输出

https://www.nowcoder.com/practice/d91a06bfaff443928065e611b14a0e95

shell 写的,shell 的语法真的是一言难尽啊

while read line; do
  s=""
  for(( i=${#line}-1;i>=0;i-- )); do
	  s="${line:i:1}${s}"
	  if [[ $(((${#line}-i)%3)) -eq 0 && ${i} -ne 0 ]]; then
		  s=",${s}"
	  fi

  done

  echo $s
done

全部评论

相关推荐

07-30 11:23
门头沟学院 Java
点赞 评论 收藏
分享
竟然收到了测评听说是双机位
投递拼多多集团-PDD等公司10个岗位
点赞 评论 收藏
分享
Twilight_m...:还是不够贴近现实,中关村那块60平房子200万怎么可能拿的下来,交个首付还差不多
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务