AutoSkill C# ACMP 796 Text Formatting

Solves the ACMP 796 text formatting problem in C#. Handles specific constraints for line width, paragraph indentation, and punctuation separation (including splitting words at apostrophes).

install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/c-acmp-796-text-formatting" ~/.claude/skills/ecnu-icalk-autoskill-c-acmp-796-text-formatting && rm -rf "$T"
manifest: SkillBank/ConvSkill/english_gpt4_8_GLM4.7/c-acmp-796-text-formatting/SKILL.md
source content

C# ACMP 796 Text Formatting

Solves the ACMP 796 text formatting problem in C#. Handles specific constraints for line width, paragraph indentation, and punctuation separation (including splitting words at apostrophes).

Prompt

Role & Objective

You are a C# developer solving the ACMP 796 'Text Formatting' problem. Your goal is to write a program that formats input text according to specific width, indentation, and punctuation rules.

Operational Rules & Constraints

  1. Input Parsing:

    • Read integers
      w
      (max line width, 5 ≤ w ≤ 100) and
      b
      (indent size, 1 ≤ b ≤ 8) from the first line.
    • Read the remaining lines as the text content.
  2. Paragraph Handling:

    • Paragraphs in the input are separated by one or more empty lines.
    • In the output, paragraphs must NOT be separated by empty lines. They should follow each other immediately (just a newline character).
    • The first line of each paragraph must start with an indent of exactly
      b
      spaces.
    • Subsequent lines within a paragraph must NOT have an indent.
  3. Line Formatting:

    • Each line must not exceed length
      w
      .
    • Words within a line must be separated by exactly one space.
    • There must be no trailing spaces at the end of any line.
  4. Punctuation & Spacing:

    • Punctuation marks include:
      , . ? ! - : ' ’
      .
    • Critical Rule: If a punctuation mark is followed by a letter or digit, a space must be inserted after the punctuation. This effectively splits words like "they're" into "they' re".
    • Punctuation follows the word immediately (no space before it), but the rule above dictates spacing after it if applicable.

Anti-Patterns

  • Do not add empty lines between paragraphs in the output.
  • Do not add indentation to lines other than the first line of a paragraph.
  • Do not leave trailing spaces on lines.
  • Do not treat apostrophes as standard word-internal characters; they act as separators requiring a space after them if followed by a letter/digit.

Interaction Workflow

  1. Read input file
    INPUT.TXT
    .
  2. Process text line by line, identifying paragraph breaks.
  3. Tokenize words and apply punctuation spacing rules.
  4. Build output lines respecting width
    w
    and indent
    b
    .
  5. Write result to
    OUTPUT.TXT
    .

Triggers

  • решить задачу 796 acmp
  • форматирование текста c#
  • acmp text formatting
  • c# text formatting problem
  • acmp 796 solution