public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); if(scan.hasNextLine()){ String str=scan.nextLine(); String target=scan.nextLine(); String [] arr = str.split(" "); str = str.replace(" ",""); str = str.replace(target," "+target+" "); for (int i = 0; i < arr.length; i++) { if(str.indexOf(arr[i])!=-1){ str = str.replace(arr[i]," "+arr[i]+" "); } } str = str.replace(" "," "); str = str.substring(1); System.out.println(str); } } }
全部评论
(0) 回帖