====== 크리스 마틴 ====== ===== 풀이 ===== * 주어진 문자열 S와의 LCS의 길이가 최소가 되는 문자열을 만드는 문제. * 일반성을 잃지 않고, S에서 가장 적게 등장하는 알파벳을 ’A’라고 하면, LCS의 길이가 최소가 되는 문자열 T는 'AAA...A' 가 된다 * [[ps:tutorial:lcs#주어진 S와의 LCS의 길이가 최소가 되는 수열 찾기]] 참고. ===== 코드 ===== """Solution code for "BOJ 7977. 크리스 마틴". - Problem link: https://www.acmicpc.net/problem/7977 - Solution link: http://www.teferi.net/ps/problems/boj/7977 Tags: [lcs] """ def main(): n = int(input()) dna = input() fewest_char = min('ACGT', key=dna.count) print(dna.count(fewest_char)) print(fewest_char * n) if __name__ == '__main__': main() {{tag>BOJ ps:problems:boj:골드_3}}