import java.util.regex.Matcher;
import java.util.regex.Pattern;

class Main
{
  public static void main (String[] args) throws java.lang.Exception
  {
    String s1 = "abcXY123XYiXYjk";
    String s2 = java.util.regex.Pattern.quote("XY");
    String s3 = "";
    String r = "(?<=(.)|^)"+s2+"(?=(.)|$)";
    Pattern p = Pattern.compile(r);
    Matcher m = p.matcher(s1);
    while(m.find()) s3 += m.group(1)+m.group(2);
    System.out.println(s3);
  }
}