summaryrefslogtreecommitdiff
path: root/sample/samp.rb
blob: b4d818fabae5f36ce9fbaee7e50e54de0be52877 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
単語 = 0
while gets()
  printf("%3d: %s", $., $_)
  while sub(/\w+/, '')
    if $& != "";
      単語 += 1
    end
  end
  if ($. >= 10); break; end
end
printf("line: %d\n", $.)
printf("word: %d\n", 単語)