标签:
-------------------------------------------
AC代码:
1 import java.util.Scanner; 2 3 public class Main { 4 5 public static void main(String[] args) { 6 7 Scanner sc=new Scanner(System.in); 8 9 int times=Integer.parseInt(sc.nextLine()); 10 while(times-->0){ 11 String s=sc.nextLine(); 12 String ans=reverseExclusiveDigitAndSpace(s); 13 System.out.println(ans); 14 } 15 16 } 17 18 public static String reverseExclusiveDigitAndSpace(String s){ 19 StringBuilder sb=new StringBuilder(s.length()); 20 for(int i=s.length()-1;i>=0;i--){ 21 char c=s.charAt(i); 22 if(Character.isLetter(c)) sb.append(c); 23 } 24 return sb.toString(); 25 } 26 27 }
题目来源: http://acm.nyist.net/JudgeOnline/problem.php?pid=266
标签:
原文地址:http://www.cnblogs.com/cc11001100/p/5791744.html