CF1213E.Two Small Strings

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given two strings ss and tt both of length 22 and both consisting only of characters 'a', 'b' and 'c'.

Possible examples of strings ss and tt : "ab", "ca", "bb".

You have to find a string resres consisting of 3n3n characters, nn characters should be 'a', nn characters should be 'b' and nn characters should be 'c' and ss and tt should not occur in resres as substrings.

A substring of a string is a contiguous subsequence of that string. So, the strings "ab", "ac" and "cc" are substrings of the string "abacc", but the strings "bc", "aa" and "cb" are not substrings of the string "abacc".

If there are multiple answers, you can print any of them.

输入格式

The first line of the input contains one integer nn ( 1n1051 \le n \le 10^5 ) — the number of characters 'a', 'b' and 'c' in the resulting string.

The second line of the input contains one string ss of length 22 consisting of characters 'a', 'b' and 'c'.

The third line of the input contains one string tt of length 22 consisting of characters 'a', 'b' and 'c'.

输出格式

If it is impossible to find the suitable string, print "NO" on the first line.

Otherwise print "YES" on the first line and string resres on the second line. resres should consist of 3n3n characters, nn characters should be 'a', nn characters should be 'b' and nn characters should be 'c' and ss and tt should not occur in resres as substrings.

If there are multiple answers, you can print any of them.

输入输出样例

  • 输入#1

    2
    ab
    bc
    

    输出#1

    YES
    acbbac
    
  • 输入#2

    3
    aa
    bc
    

    输出#2

    YES
    cacbacbab
    
  • 输入#3

    1
    cb
    ac
    

    输出#3

    YES
    abc
    
首页