题目描述
JAVA-快速
过一个样例在60ms,提交在650ms左右
java代码
import java.io.*;
class Main{
//读入字符串
static BufferedReader ins = new BufferedReader(new InputStreamReader(System.in));
static StreamTokenizer in = new StreamTokenizer(ins);
//输出
static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
public static void main(String[] args) throws IOException{
while(true){
String string = ins.readLine();
if (string == null) {
out.close();
break;
}
String[] strings = string.split(" ");
String str = strings[0];
String substr = strings[1];
char max = str.charAt(0);
for(int i = 0;i<str.length();i++){
if(str.charAt(i)>max) max = str.charAt(i);
}
for(int i = 0 ;i < str.length();i++){
out.printf(String.valueOf(str.charAt(i)));
if(str.charAt(i) == max) {
out.printf(substr);
max +=1;
}
}
out.printf("\n");
}
}
}