結果

問題 No.342 一番ワロタww
ユーザー AreTrash
提出日時 2016-04-22 11:55:06
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,111 bytes
コンパイル時間 856 ms
コンパイル使用メモリ 112,084 KB
実行使用メモリ 27,056 KB
最終ジャッジ日時 2024-10-04 14:40:36
合計ジャッジ時間 2,183 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 2 RE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace No342_1{
    public class Program{
        public static void Main(string[] args){
            const char constChar = 'w';
            var charList = Console.ReadLine().SkipWhile(c => c == constChar).ToList();
            var strList = new List<string>();

            var sb = new StringBuilder();
            sb.Append(charList[0]);
            for(var i = 1; i < charList.Count; i++){
                if(charList[i - 1] == constChar && charList[i] != constChar){
                    strList.Add(sb.ToString());
                    sb.Clear();
                }
                sb.Append(charList[i]);
            }
            strList.Add(sb.ToString());

            Func<string, int> charCount = s => s.Count(c => c == constChar);
            strList.Where(s => charCount(s) == strList.Max(charCount)).ToList()
                .ForEach(s => {
                    s.TakeWhile(c => c != constChar).ToList().ForEach(Console.Write);
                    Console.WriteLine();
                });
        }
    }
}
0