Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Fmt: Difference between revisions

From ZeroWiki
imported>Unknown
No edit summary
 
(Table transclusion repair v1)
 
Line 5: Line 5:
=== About [[Fmt]] ===
=== About [[Fmt]] ===
fmt라는 유닉스 프로그램은 텍스트를 읽어온 다음 적당히 연결하거나 끊어서 모든 행의 길이가 72글자는 넘지 않지만 최대한 72글자에 가까운 출력 파일을 만들어낸다. 행을 연결하거나 끊을 때는 다음과 같은 규칙을 따른다.
fmt라는 유닉스 프로그램은 텍스트를 읽어온 다음 적당히 연결하거나 끊어서 모든 행의 길이가 72글자는 넘지 않지만 최대한 72글자에 가까운 출력 파일을 만들어낸다. 행을 연결하거나 끊을 때는 다음과 같은 규칙을 따른다.
{{|
# 입력에 공백이 있으면 어디서든지 새로운 줄을 시작할 수 있다. 새로운 줄이 시작되면 앞 줄의 맨 뒤 및  줄의 맨 앞에 있는 공백은 모두 제거된다.
# 입력에 공백이 있으면 어디서든지 새로운 줄을 시작할 수 있다. 새로운 줄이 시작되면 앞 줄의 맨 뒤 및  줄의 맨 앞에 있는 공백은 모두 제거된다.
# 입력된 줄바꿈 문자 가운데 (1) 빈 줄 또는 공백만 들어있는 줄 끝에 있는 것과 (2) 그 뒤에 스페이스 또는 다른 줄바꿈 문자가 있는 것을 제외한 모든 줄바꿈 문자는  
# 입력된 줄바꿈 문자 가운데 (1) 빈 줄 또는 공백만 들어있는 줄 끝에 있는 것과 (2) 그 뒤에 스페이스 또는 다른 줄바꿈 문자가 있는 것을 제외한 모든 줄바꿈 문자는  
Line 11: Line 10:
# 출력되는 줄의 맨 뒤에 있는 스페이스는 모두 삭제된다.
# 출력되는 줄의 맨 뒤에 있는 스페이스는 모두 삭제된다.
# 72글자가 넘는 단어가 있으면 한 줄에 그 단어 하나만 출력한다.
# 72글자가 넘는 단어가 있으면 한 줄에 그 단어 하나만 출력한다.
|}}
입력 텍스트에 탭 문자는 없다고 가정해도 된다.
입력 텍스트에 탭 문자는 없다고 가정해도 된다.
=== Sample Input ===
=== Sample Input ===
{{|
   Unix fmt
   Unix fmt


Line 30: Line 27:
it is not followed by a space or another line break.  If a line
it is not followed by a space or another line break.  If a line
break is eliminated, it is replaced by a space.
break is eliminated, it is replaced by a space.
|}}


=== Sample Output ===
=== Sample Output ===
{{|
   Unix fmt
   Unix fmt


Line 48: Line 43:
provided it is not followed by a space or another line break.  If a line
provided it is not followed by a space or another line break.  If a line
break is eliminated, it is replaced by a space.
break is eliminated, it is replaced by a space.
|}}


=== 풀이 ===
=== 풀이 ===
{| class="wikitable"
{| class="wikitable" style="width:100%;"
|-
|-
| 작성자
| 작성자
Line 68: Line 62:
----
----
[[문제분류]] [[AOI]]
[[문제분류]] [[AOI]]

Latest revision as of 12:46, 27 March 2026

원문보기


인기도:C(A,B,C), 성공률:낮음(낮음,보통,높음), 레벨:2(1~4)

About Fmt

fmt라는 유닉스 프로그램은 텍스트를 읽어온 다음 적당히 연결하거나 끊어서 모든 행의 길이가 72글자는 넘지 않지만 최대한 72글자에 가까운 출력 파일을 만들어낸다. 행을 연결하거나 끊을 때는 다음과 같은 규칙을 따른다.

  1. 입력에 공백이 있으면 어디서든지 새로운 줄을 시작할 수 있다. 새로운 줄이 시작되면 앞 줄의 맨 뒤 및 줄의 맨 앞에 있는 공백은 모두 제거된다.
  2. 입력된 줄바꿈 문자 가운데 (1) 빈 줄 또는 공백만 들어있는 줄 끝에 있는 것과 (2) 그 뒤에 스페이스 또는 다른 줄바꿈 문자가 있는 것을 제외한 모든 줄바꿈 문자는

출력 과정에서 제거될 수 있다. 줄 바꿈 문자가 제거될 때 그 문자는 스페이스로 치환된다.

  1. 출력되는 줄의 맨 뒤에 있는 스페이스는 모두 삭제된다.
  2. 72글자가 넘는 단어가 있으면 한 줄에 그 단어 하나만 출력한다.

입력 텍스트에 탭 문자는 없다고 가정해도 된다.

Sample Input

  Unix fmt

The unix fmt program reads lines of text, combining and breaking lines so as to create an output file with lines as close to without exceeding 72 characters long as possible. The rules for combining and breaking lines are as follows.

    1. A new line may be started anywhere there is a space in the input.

If a new line is started, there will be no trailing blanks at the end of the previous line or at the beginning of the new line.

    1. A line break in the input may be eliminated in the output, provided

it is not followed by a space or another line break. If a line break is eliminated, it is replaced by a space.

Sample Output

  Unix fmt

The unix fmt program reads lines of text, combining and breaking lines so as to create an output file with lines as close to without exceeding 72 characters long as possible. The rules for combining and breaking lines are as follows.

    1. A new line may be started anywhere there is a space in the input.

If a new line is started, there will be no trailing blanks at the end of the previous line or at the beginning of the new line.

    1. A line break in the input may be eliminated in the output,

provided it is not followed by a space or another line break. If a line break is eliminated, it is replaced by a space.

풀이

작성자 사용언어 개발시간 코드
문보창 C++ . Fmt/문보창

쓰레드


문제분류 AOI