wcの機能実装。
Java
import java.io.*; public class LineCount { public static void main(String args[]) { try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String str; int line = 0; while ((str = in.readLine()) != null) { line += 1; } System.out.println(line); in.close(); } catch (IOException e) { e.printStackTrace(); } } }
Python
Emacs Lisp
Scheme
SoftwareTools CategoryPrograming CategoryEmacs CategoryPython CategoryJava