import java.util.Scanner;

public class TextEditorReplace {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();         // Original string
        String wordToReplace = sc.nextLine();  // Word to be replaced
        String replacement = sc.nextLine();   // Replacement word

        String result = replaceAll(str, wordToReplace, replacement);

        System.out.println(result);
    }

    // Function to replace without overlapping matches
    public static String replaceAll(String str, String word, String replacement) {
        StringBuilder result = new StringBuilder();
        int i = 0;

        while (i < str.length()) {
            if (i + word.length() <= str.length() && str.substring(i, i + word.length()).equals(word)) {
                result.append(replacement);
                i += word.length(); // ✅ skip entire word, no overlaps
            } else {
                result.append(str.charAt(i));
                i++;
            }
        }
        return result.toString();
    }
}