java 代码
import java.util.*;
public class Main{
public static void main(String fa[]){
Scanner s=new Scanner(System.in);
String x=s.nextLine();
String [] a=x.split(" ");
int k=a.length;
String u=new String("");
String b=s.next(),c=s.next();
for(int i=0;i<k;i++){
if(a[i].equals(b)) u+=c;
else u+=a[i];
u+=" ";
}
System.out.println(u);
}
}