<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Agora que a fase um ja terminou, podemos brincar com os problemas.<div><br></div><div>O Wesley Seidel, me chamou hoje no Google Talk e comentou sobre os problemas. Ele me mandou os problemas e me pareceram bem legais, eu parei para mexer em apenas um deles hoje:</div><div><br></div><div><span style="color: rgb(51, 51, 51); font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; line-height: 20px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; ">Alphabet Soup</span></div><div><br></div><div><br></div><div><div class="mvm uiP fsm" style="margin-top: 10px; margin-bottom: 10px; font-size: 11px; line-height: 16px; color: rgb(51, 51, 51); font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); position: static; z-index: auto; "><p style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; ">Alfredo Spaghetti really likes soup, especially when it contains alphabet pasta. Every day he constructs a sentence from letters, places the letters into a bowl of broth and enjoys delicious alphabet soup.</p><p style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; ">Today, after constructing the sentence, Alfredo remembered that the Facebook Hacker Cup starts today! Thus, he decided to construct the phrase "HACKERCUP". As he already added the letters to the broth, he is stuck with the letters he originally selected. Help Alfredo determine how many times he can place the word "HACKERCUP" side-by-side using the letters in his soup.</p><h3 style="font-size: 13px; color: rgb(51, 51, 51); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Input</h3><p style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; ">The first line of the input file contains a single integer T: the number of test cases. T lines follow, each representing a single test case with a sequence of upper-case letters and spaces: the original sentence Alfredo constructed.</p><h3 style="font-size: 13px; color: rgb(51, 51, 51); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Output</h3><p style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; ">Output T lines, one for each test case. For each case, output "Case #t: n", where t is the test case number (starting from 1) and n is the number of times the word "HACKERCUP" can be placed side-by-side using the letters from the sentence.</p><h3 style="font-size: 13px; color: rgb(51, 51, 51); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Constraints</h3><ul style="list-style-type: none; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li>1 < T ≤ 20</li><li>Sentences contain only the upper-case letters A-Z and the space character</li><li>Each sentence contains at least one letter, and contains at most 1000 characters, including spaces</li></ul><div><br></div></div><div class="examples_box" style="color: rgb(51, 51, 51); font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 14px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); "><div class="clearfix mhl" style="zoom: 1; margin-left: 20px; margin-right: 20px; "></div></div></div><div>Eu anexei o input "alphabet_soup.txt" ,a saida "certo.txt" e o meu script "script.pl".</div><div><br></div><div><br></div><div></div></body></html>