週間チャレンジ081


これは、クイーンズランド州の公共の休日ですので、何よりも行うことができます.
this week's
タスク1 - 1共通ベースストリング
これを行うCPANモジュールがあるかもしれませんが、TWC用のCPANモジュールを使うのは避けてください.
この仕事のために、私は一度に1つの手紙をループしました.この文字列は、文字列全体が1文字以上の文字列に一致する場合に、両方の文字列のベース文字列と見なされます.


» ./ch-1.pl abcdabcd abcdabcdabcdabcd
abcd abcdabcd

» ./ch-1.pl aaa aa
a

タスク1・2周波数ソート
このタスクはより直進的で、以下の手順に分けられます.
  • 入力をチェックしてファイルを読みます.
  • ファイルを読み込み、それを文字列につないでください.
  • 除外する文字を削除します.
  • は、周波数ハッシュに単語(白いスペース\s+によって切り離される)を置きました.
  • は、周波数をソートします.
  • 順に周波数にマッチする文字列を表示します.


  • » ./ch-2.pl input.txt 
    1 But City It Jet Juliet Latino New Romeo Side Story Their Then West York adaptation any anything at award-winning away become before begin best classic climactic coexist control dance do doesn't end ending escalates families feuding form former friend gains gangs goes happened hatred heartbreaking highway hoping in know love lovers meet meeting neither no one plan planning point romantic rumble run secret sends sister streets strikes terribly their two under understanding until violence warring what when where white whoever wins with wrong younger
    
    2 Bernardo Jets Riff Sharks The by it led tragedy
    
    3 Maria Tony a can of stop
    
    4 to
    
    9 and the