windowsã¯ãã»ã¨ãã©ã®ãã¦ã¹ã«ããæä½ããã¼ãã¼ãã§ã§ããããã«ãªã£ã¦ãã¾ãã è¶ æåãªã¨ããã§ã[Ctrl]ãæ¼ããªããCï¼ä»¥ä¸[Ctrl]+Cã¨è¡¨è¨ãã¾ãï¼ã§ã³ãã¼ã¨ããã®ãããã¾ããã ãã®ãã¼ãã¼ãã·ã§ã¼ãã«ããã§ããå³ã¯ãªãã¯âã³ãã¼ãããããæ°åæ©ãæä½ãã§ãã¾ããããç¥ã£ã¦ãã®ã¨ç¥ããªãã®ã¨ã§ã¯ã大ããå·®ãã¤ããã®ã§ãããããããã®ã³ãã¼ãã¢ã¤ã³ã³ã§ãããããæåã§ããããç»åã§ããããããªãã§ãã³ãã¼ãã¦ãã¾ãã®ã§ããã¯ãªãããã¼ãã¨ããæ¦å¿µãèããæ¹ã¯å¤©æã§ãã ä»ã«ãããªã沢山ãã¼ãã¼ãã·ã§ã¼ãã«ããã¯åå¨ãã¾ãã ã§ãã¡ãã£ã¨èª¿ã¹ã¦ã¿ã¾ãããããããç¥ããªãã·ã§ã¼ãã«ãããå±±çãã§ããããã使ã£ã¦ã¢ãã¿ãä»äºãåºæ¥ãï¼ããã«ä¸ç¬ã ãè¦ããï¼äººã«ãªã£ã¦ã¿ã¾ãããï¼ ã¹ãã³ãµã¼ããªã³ã¯ åºæ¬ç·¨ ãããåºæ¬ã§ããå¿ é ã§ãããã®ä½ã¯ãã£ãã使ãããªãã¾ãããããã¦ã¹ã¯å³
#!/usr/bin/rdmd // Computes average line length for standard input. import std.stdio; void main() { ulong lines = 0; double sumLength = 0; foreach (line; stdin.byLine()) { ++lines; sumLength += line.length; } writeln("Average line length: ", lines ? sumLength / lines : 0); } Standard input Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris tristique rutrum sem, nec convallis enim bibe
æ¨å¹´7æãæ±äº¬ã§åæ°å¹´ã¶ãã«é度5ã®å°éããã£ãã以æ¥ãè·å ´ããèªå® ã¸å¾æ©ã§æ»ãããã®å¸°å® ããããªã©ãé²ç½ã°ããºã売ãã¦ããã¨ããã éªç¥ãä¸è¶ãªã©ã®å¤§ããªå°éã®è¨æ¶ãæ°ããããã¯ãä»äººäºã§ã¯ãªãã ã¨ããã§ãæ°è±¡åºãªã©ã§ã¯ä¸æ¨å¹´ãããç·æ¥å°ééå ±ãã¨ããã·ã¹ãã ã試é¨éç¨ãã¦ãããå°éã®å¤§ããªæºããæ¥ãç´åã«ãã¨ã¬ãã¼ã¿ãæå¯éã«åæ¢ããããããå°éãæ¥ãããã¨é³å£°ã§ç¥ãããããããã®ã大ããªæºãã¯éæºå°ããå¨å²ã¸å°ããã£ããä¼ããã®ã§ããã®æéå·®ãå©ç¨ãã¦ãããä¾ãã°æ±æµ·å°éãçºçããå ´åãåå¤å±ã§ã¯å¤§æºãã®25ç§åã«ãæ±äº¬ã§ã¯40ç§åã«ãå°éãæ¥ãããã¨ããæ å ±ãå¾ãããã¨ãããä¸é¨ãä¸è¬å®¶åºã§ã®è©¦é¨éç¨ãå§ã¾ã£ã¦ããããã ã 40ç§ãã«ãã麺ããã§ããªãæéã ãããã£ãã人ã«ä½ãã§ããã ãããã試ãã¦ã¿ããã¨ã«ãããã¾ãã¯å°æä»äºããã¼ããã¹ã¿ã¼ãã ã¬ã¹ã³ã³ããæ¢ãããå ä¸ãçã¥
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}