wc実装機能の一部。
Java
実際はintでは数える事は不可能だろうが、、
import java.io.*; public class CharCount { public static void main(String args[]) { try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String str; int strlen = 0; while ((str = in.readLine()) != null) { strlen += str.length(); } System.out.println(strlen); in.close(); } catch (IOException e) { e.printStackTrace(); } } }
Python
Emacs Lisp
Scheme
SoftwareTools CategoryPrograming CategoryEmacs CategoryPython CategoryJava