我需要创建一个程序,允许用户输入字符串。我只需要选择数字,然后按每个数字3个数字分组。如果字符串的长度不能被3整除,那么在最后一组有两个数字。有人能帮我吗
sample user input : ue3j8dj2pud7y3g378
Target output: 382-733-78
sample user input : babdh3uh23737gvrh27h3h4
Target output: 323-737-27-34
Sample user input: bs34bhev26gv362
Target output: 342-63-62
这将在没有regex的情况下解决您的问题:
相关问题 更多 >
编程相关推荐