본문 바로가기
Problem Solving/백준

[백준|파이썬] 21966: (중략) (실버5)

by 청량리 물냉면 2023. 4. 27.
반응형
문제

https://www.acmicpc.net/problem/21966

 

21966번: (중략)

알파벳 대문자, 알파벳 소문자, 쉼표, 마침표의 아스키 코드는 각각 65-90, 97-122, 44, 46이다.

www.acmicpc.net

 

 

🐍파이썬
import sys
n = int(sys.stdin.readline())
s = sys.stdin.readline().rstrip()
if n <= 25:	#글자수가 25자 이하이면 
    print(s)	#s를 그대로 출력
elif n > 25:
	#앞/뒤 11글자를 제외한 나머지 부분에 "."이 존재하지 않는다면
    if "." not in s[11:-12]:
        a = s[:11]
        b = "..."
        c = s[-11:]
    #"."이 존재한다면
    else:
        a = s[:9]
        b = "......"
        c = s[-10:]
    print(a+b+c)

 

반응형