解题思路:
注意事项:
参考代码:import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
String str=scanner.nextLine();
char [] ch=str.toCharArray();
char ch1=ch[ch.length-3];
char ch2=ch[ch.length-1];
StringBuffer sb=new StringBuffer();
for(int i=0;i<=ch.length-4;i++)
{
if(i>=0&&i<=ch.length-5)
{
if(ch[i]==ch1)
{
ch[i]=ch2;
sb.append(ch[i]);
}
else {
sb.append(ch[i]);
}
}
else
{
break;
}
}
System.out.print(sb);
}
}
}
0.0分
0 人评分