Comment detail

LL Golf Hole 2 - 文字列に含まれる単語の最初の文字を大文字にする (Nested Flatten)

This comment is reply for 6959 あにす: 単語と単語の間には空白があるって前提でい...(LL Golf Hole 2 - 文字列に含まれる単語の最初の文字を大文字にする). Go to thread root.

がんばってみました。
1
using System;using System.Linq;class d{static void Main(string[]a){int c=0;a[0].ToCharArray().ToList<char>().ForEach(b=>{if(c!=0&&a[0][c-1]!=' ')Console.Write(b);else Console.Write(b.ToString().ToUpper());c++;});}}
でも、こっちの方が短かった。
1
using System;class P{static void Main(string[]a){for(int i=0;i<a[0].Length;i++){if(i!=0&&a[0][i-1]!=' ')Console.Write(a[0][i]);else Console.Write(a[0][i].ToString().ToUpper());}}}

Index

Feed

Other

Link

Pathtraq

loading...