Skip to content

Instantly share code, notes, and snippets.

@weirdbricks
Created September 16, 2014 22:57

Revisions

  1. Lampros renamed this gist Sep 16, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. Lampros created this gist Sep 16, 2014.
    11 changes: 11 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    #!/usr/bin/ruby

    #By Lampros Chaidas
    #wc replacement in ruby

    input = $stdin.read
    words = input.split(" ").count
    newlines = input.lines.count
    characters = input.length

    print "\t#{newlines}\t#{words}\t#{characters}\n"