牛客网编程练习之去哪儿网2017校招题:身份证分组

牛客网编程练习之去哪儿网2017校招题:身份证分组

太水了不用思路,直接截取输出就是了....

 

AC代码:

import java.util.Scanner;

/**
 * @author CC11001100
 */
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		while (sc.hasNextLine()){
			String s = sc.nextLine().replaceAll("\\s+", "");
			if(s.length()>14){
				System.out.printf("%s %s %s\n", s.substring(0, 6), s.substring(6, 14), s.substring(14, s.length()));
			}else if(s.length()>6){
				System.out.printf("%s %s\n", s.substring(0, 6), s.substring(6, s.length()));
			}else{
				System.out.println(s);
			}
		}

	}

}

 

题目来源: https://www.nowcoder.com/practice/58766632a6cc45c0a1158fea2db91728?tpId=85&tqId=29888&tPage=1&rp=1&ru=/ta/2017test&qru=/ta/2017test/question-ranking

 

.

相关文章:

  • 2021-10-09
  • 2022-12-23
  • 2022-12-23
  • 2021-09-03
  • 2022-12-23
  • 2021-12-18
  • 2021-11-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-25
  • 2021-06-26
  • 2021-10-10
  • 2021-09-25
  • 2021-08-16
  • 2022-12-23
相关资源
相似解决方案