class String
  def centered(width = 80)
    return center(width) if width > size
    self[(size - width) / 2, width]
  end
end

ARGF.readlines.each{|l| puts l.chomp.centered(72) }
__END__
0         1         2         3         4         5         6         7
012345678901234567890123456789012345678901234567890123456789012345678901
This line is intentionally longer than 72 chars to test String#centered works fine.