結果

問題 No.342 一番ワロタww
ユーザー papinianuspapinianus
提出日時 2016-09-28 14:24:20
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 75 ms / 5,000 ms
コード長 1,046 bytes
コンパイル時間 1,042 ms
コンパイル使用メモリ 112,372 KB
実行使用メモリ 31,536 KB
最終ジャッジ日時 2024-04-23 13:33:44
合計ジャッジ時間 3,067 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
29,372 KB
testcase_01 AC 72 ms
29,484 KB
testcase_02 AC 74 ms
29,492 KB
testcase_03 AC 73 ms
29,604 KB
testcase_04 AC 74 ms
27,568 KB
testcase_05 AC 72 ms
31,532 KB
testcase_06 AC 72 ms
29,368 KB
testcase_07 AC 70 ms
31,536 KB
testcase_08 AC 69 ms
29,240 KB
testcase_09 AC 75 ms
29,360 KB
testcase_10 AC 74 ms
29,880 KB
testcase_11 AC 74 ms
29,744 KB
testcase_12 AC 71 ms
29,240 KB
testcase_13 AC 71 ms
31,536 KB
testcase_14 AC 67 ms
31,380 KB
testcase_15 AC 66 ms
31,280 KB
testcase_16 AC 69 ms
29,880 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.RegularExpressions;

namespace no342
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();
            var exp = @"(?<phrase>[^w]+?)(?<ws>[w]+)";
            var reg = new Regex(exp, (RegexOptions.Multiline | RegexOptions.CultureInvariant));
            var matches = reg.Matches(str);
            var substrs = new Dictionary<int, string>();
            foreach(Match match in matches)
            {
                var wlen = match.Groups["ws"].ToString().Length;
                var phrase = match.Groups["phrase"].ToString();
                if (substrs.ContainsKey(wlen))
                {
                    substrs[wlen] += "\r\n" + phrase;
                }
                else
                {
                    substrs.Add(wlen, phrase);
                }
            }
            Console.WriteLine(substrs.OrderByDescending(x=>x.Key).FirstOrDefault().Value);
        }
    }
}
0