牛客网编程练习之编程马拉松:解读密码

 

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()){
			System.out.println(decode(sc.nextLine()));
		}
		
	}

	private static String decode(String s){
		StringBuilder res = new StringBuilder();
		for(int i=0; i<s.length(); i++){
			char c = s.charAt(i);
			if(Character.isDigit(c)){
				res.append(c);
			}
		}
		return res.toString();
	}

}

 

题目来源: https://www.nowcoder.com/practice/16fa68271ee5448cafd504bb4a64b482?tpId=3&tqId=10927&tPage=1&rp=&ru=/ta/hackathon&qru=/ta/hackathon/question-ranking

相关文章:

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