给你一份『词汇表』(字符串数组) words 和一张『字母表』(字符串) chars。
假如你可以用 chars 中的『字母』(字符)拼写出 words 中的某个『单词』(字符串),那么我们就认为你掌握了这个单词。
注意:每次拼写时,chars 中的每个字母都只能用一次。
返回词汇表 words 中你掌握的所有单词的 长度之和。
示例 1:
输入:words = ["cat","bt","hat","tree"], chars = "atach"
输出:6
解释:
可以形成字符串 "cat" 和 "hat",所以答案是 3 + 3 = 6。
示例 2:
输入:words = ["hello","world","leetcode"], chars = "welldonehoneyr"
输出:10
解释:
可以形成字符串 "hello" 和 "world",所以答案是 5 + 5 = 10。
提示:
1 <&#61; words.length <&#61; 1000
1 <&#61; words[i].length, chars.length <&#61; 100
所有字符串中都仅包含小写英文字母
来源&#xff1a;力扣&#xff08;LeetCode&#xff09;
链接&#xff1a;https://leetcode-cn.com/problems/find-words-that-can-be-formed-by-characters
著作权归领扣网络所有。商业转载请联系官方授权&#xff0c;非商业转载请注明出处。
package leetCodeTest;import java.util.*;public class 拼写单词 {public static void main(String[] args) {String words[] &#61; new String[]{"jdimdfzbygjgdrsisgblztowvwzewvrwuizaihnctoonlykrbzncqvbzjahxvyswdzcbwaqliiyzbddtsxrwb","ybdhccgznflezzvifoshbatwedohwwhyajylprerarbsjcll","febacfxkrwnkyoyhykzbfuueohtkvqjkrmclmiinmpwhumaummpxjqmvqnvlwkmiizewfnqnmjqmnxacrhgxodyglvzyyii","tcymwrytgfnbggzqptaqwzpkjhleisuwsfzhna","rdvuvrrqerihadnurdfkzfiwtodnzcwvrmuwkyjhgkdjtnuwlclnhttidukyhfdzozix","mjoryzsbvkqlmtmcmsjljloabfaliecpmmiumq","iwzpczbknmqrankiypxjxthlzsvhchpqv","dqpgxyspa","igsvidvyonqyprvkoaphuvqaxcceefckypojgfdiyubagihkztnhindjcdpolt","iamvwzvdbfonuurfdzcnvohqrpyxgmjvbyiyovvccsilkblgpojmwvhdsewldgzvdlnecfudjjkmgmil","lbtjpakidwtavvtllcpekgcmqigmrfkvfjyzbxlpxtnklqrfoasnocjnlhzafcjqdjqgmuardsifyrlkvrndat","tfqdhgvduounzgbdnipofenkqzqrlntcppwkk","dwtuwpqugxvkjnhxvpxsdxyeurkldhxnpmicxmntiokhcclptbbbamzcrwachvzi","pdnmdakvxnwdmibwqclesycgomztyowtjskvwiwuaumwubrmkli","sxabmaciwtbbtwwawfhqisthjqxsxslsptcxqgsrzxiirxmzzmoulqmwzwatkrjqgpelkenulstuxwzjno","enhtapuuyildahjyryubmjqdhbtfhjzhwppqbzriytu","momfgjhyxzpsp","hhdyxizwufxjewqvbforsauqgexpqgrhbmycwcaxbwldljuhclpyfawbhypinsfjepgded","cgowwwhvlaziuptfsxqygxxnqxbregcwaodyklkkywpdtofrupmeeaeoemmpdwltdzbvebuzfumfdbdqu","xspywgpzetvfdzeyterumsweldzsdarwshssaxlfgqqlckcyeealjqdfkjdncoivvgkmcvaod","ubuubimfvxvplgikclwilovjdkns","luzrzwfwzlunkwlvpjqpwckboxhgufsjlpmklxxtiuvlvaydkdvqumhiospabiemygntpfotocufttzzewkbxf","mqqktykhjxtebccvpwttybgvkkxndvxfagdnjmbezlmdgw","opcobbidwttpeisekgmowtgcozeinvfliqbkbrtkvwxdobavjyrknsadjijwybtbayfytxeotfp","c","cefqqjft","ijavryhszfeevxvrcubkvpobxajzfjhnyffkdnucigmisvalwfngwahy","pzfkcxeehzytxrtbdqqcoaccnqiynsjypfrcablnznvmthga","tlekyalvnyxsvr","jsahgkicszfcheyqafvflufycicegxclqpbmvmakjbhtuwhcxerxwspgzsrubfqblbhavlwfhx","tvzrvrsnjetkoxbliawcvzzakpmhhvnjubczcpgobuqjqffsrdxtxjarzgsuryajuatcyfbroginvjhlauzbrkhssf","dqbrdlmkhkrdzecilmfuavrphuxbqjo","pmdpypebaobezmcfazewjbabjqjvrefyravwrvneyfpesbwnbbymuvovjvqgfwmzcsweifbpkuzicpjsj","wfobqlvkmehlrh","soormzqclvrrhftinorqqtfprxqufqsadalczqgbdnirkohqvzucsuunzjvbcfrryzztgy","lfpvzygoenywdaddtsnrtmdhqnrkuyydwbwmzbwxzmoxwxvyttomlqdsekhyoaltxjhdtggwxrueelgh","sikbegcpidcsnbierikpueovdqaxzis","bchfnjcxqkfavrpotyghvhdzfsnigpgeuen","igcpbhexbrhqgvzbjuvgehqrntbdfluouysupmtykobvkxzhumwxtntmbnyditvjmgoqtbiabkzfx","xlgxysycbrskihoxiolefjhgdluugsuvvlhxlbqxzcqgqoxrmhmrylpfbarrplqgpvep","oivjponqitutsacujnlmwotbeinwfygnzdzqet","yktuffealtkznzvccxuzejpruspfldidkheondsmdbgwrabkmwgtbguayqhyiynfjfqgbpxoizlhottxeqbauj","sxghynxeletecuqbafmqmlmiwlaenuujfipfkeylcyfjxkznpkc","gxekcfwgn","zitnbxgfpnzdoaahksuajugypfdlzwzadmksgtuqoevnqjkwoybabozgovuzlazwlopcuofwnqpkcpyupnh","oydlvwonusmqypnlpwhdakzdoft","kphotdvwvjypd","cdcwreimmvstaytgnlwrdzumkilseqrorlsgzmmogjixszokypjalqmexhjesknsnpgjowypsno","bbfbbepyutonbnmtbmmdrgxnhoifxluendcayelykgoglnrucegkhoczbajaobdggmusdbdllz","tmelbseagubuvjjvpzkyvbxcyxzoxjvhcqwmesdwi","twbedagexfuyyghuqxgwxmtbckchmiknghoaswufihzcmcdkyiqphjwpgpqsavoiiejfoqoucmvcahxmshu","aqnipfzpclcsyuecagdfho","cfcigrykqaeclkckntqkioexxvzvqfyirgqiwsbamtigxewdgpbhxsrwiofxzakvofqzbznbkfpfqpnns","uoyzgkluftocnmbdrpyrmaywyyevbfcebzfxqljgigcgfmoeznqpkbmiwmziqlmdealiknlfzdwbadyjunth","pniwsxvfxlsfhkhijuwcdvzahgzjmxdjpggcmynlfeitrggpgfudhfsswqaxapmkalrmiikrdcqyovqqyiasc","hjoff","zchyafrvstjxrpcrjtxrzqtgemtnbioizjvrsbmmwsqfcqtovk","rqopixeyjdtwekhdilymtmbvpllrbcfkfojwyzgvhlhxvflywzqiiqlnwooudmwjtfikdgecxsbwxnmmyaxkqyxbqsgn","jrjjoqkpqfjslcklltztyhkmrqmlmvjczidsswyhmyowxuunogxomhxtireakdfheffjaarcmonvxxuhvlnpujenrvjpsdrngsif","oluqeooumhfdizvbmzzxznccypdfqeibvhhbbknqcvdryuiqzmheivglczcxcneypm","odiyjnibfvnmojenjmtnawnnsatslheoqliyqtsmrxojxlsqep","xodhotsxujcannmgvmszwnpvlyxrvfntk","pal","pfuaarkhepsjjtljpdhne","cmravobrplecnohwhfcxbgsmkqkqjmdrpz","rhwlfbsjnoileeuatpwpzxsqssfxbakasvvhrnfvsnji","cprpqsoavnarqcyjhuxeeapjwkbrignbhgkufpdbentazdgfrjksrmbvcbwypcrh","ouxsbfsvuihlhjcsiccibxvxtpwuzhrthhotbinvclelxhujtxqnpzoylzatzgdvawmfjwychqeopcrdjnejdtfkdign","zhoel","jwcdwcwlljltoiepktkflngdsqeagqwowkbopjzwbruhzntusrixinwvf","amn","zpcniceupkondvpyjbckasmevmoxquumalzrnhpxskxugik","cvefdfpkcctzpipaodrygoaoesgvihhhthygs","bkohexejlvylwkrykmmcgcf","olpytsjqlkdpwi","qsidlbvlccnjtyrupfxprlwhcynoyxlbrxjojkiqrsawbaumnzkdkzchommc","ixnpbwnjtpqczoybczviqfbjtuxjdibzgispvxdnjppranzldirjcxut","zlzvegbitlzahbmkectimwpbaletlxpcotygzvwridoiswxiuawtz","fhptimdesuoqzjiblcwnhhbaxptzraksykvfpunxfufrwcmvqnwjocoiy","aiyorgqnkvdopapcjpenkymhnynpkzyntylozbydnpibdrpbvcutpxudrcsizoyk","nmuyeikwomlcripugwjypkfvbvizvrmndhsacmdocjjdhtnqvuxmgrcfeczuxsa","geulhswpnmyweuswggltxsguxnnvecovqxvteiuadxgdksmjtitwcpzmbxicwvclkndttsduxb","tbdazbskpejjkquorhfdafdvlgglefjhqguriqaefpvhcqscfhtvkimqvjzxtaf","ldnnyerfedgsffdhpbmbwuubrzsjibafxqccryuljvusadrlfxqw","meylutslakssulbpvfonrfmvugblinwzrfgopxafnwwdcuufjuaimxrbheehjndxbiohskmvjrmpcewvvvrbaqbkfffgbb","ygjmeswiarqiwkpuzjsfnbabtvgapaoazzkuafcpuuavzmvvhcnwedpgbizznkygooedxjggbdkrgkcyaautpvwwnvlfwikyl","mjgnewabmklmzwazyhcdoyqowpgrdcnuzwoha","nljceveqjwgwmylmbgkawzjdvueoglyxdbpdyqpgwgtmixlkxphtltijcm","maunpmlrxvreydzpzllevzlxpbkeeyrsskuhtklrnmpytaugdnuvgotmptgprsfcrcenxg","wxqdzhmffyesnlbweaipjgjojsvvfmyyrsxjuqgyseuojmsemhgxalbbdiepwbizkf","ricbkdxnkujtlgnuzcx","gttdwdoclpkcejljedytqilnrpgsphfetbxztwihmhhspvyfdtbavl","srmlsxsnohyy","lpg","qpmfbycwecpgnthstqwcdwrfxlykjteonfqvgqfxgyjmnqfh","guojktcpspmbtsfucyze","uhkpgnmkewkhymqyfzxbb","qifzafbdvmjgfmzdotznlbzsllakihgzdpmwliwmmyoyovofyhxupehqjryccvzsejvnfebbyaxtwji","xifotcwgywruiymsgmkamaaqnawvooilhqflxptbiewtzcufqvlldsxapunlbbzurwlegvspxhkjnivmeuxu","ewpkblzobahkxvmaorqxotmlszkjlnbbqhgfeoymxntpsilzzmgknzkpgwanlajbagyxdaxvgg","xuxovygmkcyukmtsfwquiw","otvowenq","thfd","upypegljhttngfmnrwoqunnysvaauywjppaqlqayfcpajnirjgwjmaeyfpkexyfhdztctsctgfyoyi","pypgyhubkosgpcsiucjvocobhfiayxjydpjakwpduaybk","zskfzaqcegxmcxjyyraaaskmurewhpdgeccdiqdruevkipfynevvgdwpmevxolczrssveyf","qazabogdtspviktvigfumcliotxzlfgqdmnwnejdyuiaxdrhjpzpodjmk","qozbqbokeous","gwlvoonxjrhvzyqmnlwfykqex","uaumnvenxonkofoquxkbevxhinefttwiymaeecwzlknmzljzcldmmpekrnfdql","xzrghwbgmljjbboonroxerqkbuygiouaylhkdauoagnizfndqzabdbycwa","wrmcoohqyiwguwxntxlaxlrcambhvughnujvqxtvxuiyvvbgdsqukkdrprcxk","kajvhekqzmmolchwsnhwsotawzndwpoxxcphjxvjhwyqhzffyilcvwin","osnjdwvjwtqplvovigvmkkuvzvyrnqbfpliyhvtbquiyucvfxzrvupjsaxisiqvdvjuavclfmbeddvype","aa","hzvczfzpteogbzckschfxooyybkkyodaoncwlfjrrozjedbniwhmrxbxgvsknpjtntia","mnsplhfonlxqrfaoiqbroqrtvjdurciceuyazjslbxkznbjsaaiaiumshqmcdjrzkzkxskoiacnlwuumchanvp","y","llusbfpxolpcuxqlxsxusxljtvzoaukhebnimpaczhdgtlpdzmmxvqi","cxxpgjxrfajufcyljmtomctdloifssgmqpdxnvnojtbczsunjirzmpavidwgvcrwioubusmrprda","elyrktioorsgpmdogctdzoyumidyhkrcxjpsnqcjzqacpzsockdmpbobd","cwklazpkfcycsdfjmjryxlikfpcjnjvjwckghqzhgcyhrfbfetmbakpnzjuvgmfngqluuxqvgprdmcclrdwkazvjciecidp","jxgoqngvvdqgfzdtnlppzlpyxissnjpbcfvvdlzztbzspiwfglqbmvvqnpiscxzdmclnervesecqyyuppzeqnfzpddjn","itprgrhysrwmhhaawatgzcoifzidwsmbubyigwcewvfsxipilgmyjoabnhovsr","sdvroatgoiowdqxcchbkxuabrrxqrwqwaamebflbubghhdujyvjtrqjhs","lcizmwl","zbycvvwywvprknqomewgnukldcvzehmailqnpabcehjrsespzmcchlfiutwqhlcgvwwzgftqnsmmlxdot","ycfajupfdilekjptftutzfultpjrupvajbtphxuxjacorflgh","voeqeuorsrbostmivapuxevtmilhzxpeswivyiqkflxgdwpdieptpvplailynqsakhfnoluw","qhaqtselyauycemuspozlctffeurfclumidaildhczgorkrvydqcraxhstswypcjktjzyijgbmozwfk","cifmzmjvtuwzrvszvlkrfbxdztjtwttqxvwtrrdflwraygcnncq","tqwdkiowbbeobixyurrlgzejkvrgpatwdfbkmexu","qmohzsrkypncpinlhthrrjgalqhemwdliueqrnqbjqk","jmuafzdxuyawoopckcihbgibuieaipjjuvelngmdwyhkthoeslmatibnxkexgiasuemzbbagijhuekilhguanvsi","mcfttopijlwyiqjfddidkbrrznxiggspgrzv","wkmpshoyvpcavisaluywwuxwggyguwyrewlsdxuhomkcipelifkzyremrdqnxriaddpzpqzfvdwyiuhkiyxlekpskkzawv","qhcgluzepldgtcsyfquniwdy","sqoxryxxgzqsjclmuvqiqawuidtihogggxjfzkniqjpyjwatpmecziomfgdkis","istjakvtyzzaelduexpmnthzwgkwnhqtfdblilypkxirpnlnqrsjffthjdtbfwhxueboquotzvccnexwcre","lrydfbliheallvpxasjfjfzeehxkxrgabcofnwetcjueolpgexetfieksdkeopci","tptyttbimmijjnbciadfkwspfofbufpjuxcxylcbfdzoiqtsybxehtrryakqyptjkkkcsiqboreoiovoekelnx","zavzklwqyzokxnunkhjylukjqcsrvlkuxs","rtqyhcfhucrqadultzlumazicdu","ohobdcictit","xfganyznjxztlenimrljgyifwypjvmcxmjpdwfgspiyoyjetbrtrtxktiobhnzts","fuvsdvoviyyzqzxliebnxpawtmczyiylnzvbyfilmbbgjoseyxbqawi","kqtwdwcgtbgzmzejvskhevbokzdvomkawvqmsfwdhbnqdxlgy","eplegvqtvywmbqtndpdcbbylonvowepnneqlywrtnryudbqorjasivuwkszxzfwqdqozrbubjuovkxehkenmlorvavznwoxbbj","qjlynqakaxhvmbtzaymetjsilvmxfxjnlspufjxffwksiuyztzklwzvocatawrewicebujfgpq","mghamvubjtiuviceyccpejehmumtaeejraargsbvfxsgbhigjejuvreuvgbjtzbrzmsrsgjhblzqoz","zzvkiqrtyfssalidbudmgpjadfnvewcjxxeizrrkv","wrsegnaznxixzhyhdmslgcgslrcmyvclh","fujynwgcgocsbkzuvvppknspbvnitwbxnaf","lihsicgcjuablnfflwuwifcrfwiioafxxbbqwgzibnwhoxzhvmhbgjafvcumjgthiqiuacojuycejodzghucnpogjyykzitugkcr","wibifkhjooviuxbpucnreszrshiyfgcfywfncxiaodriejwrkskkwlgwxmzkrzfz","pgmogxujiwkgusbriztdkzkoirswmxwmjjeomcbzg","xzoksdragbjecrmropprjbtglqcsxzxaxfthhlkrcshobyisrlv","gfgfhiljcgckutrrectpweexqmqntccqekojlbxsnvmkiareesbazlgsmunbagbmurgwzmb","kldgnhosnhqdfpplqbpujzcpozokvyopbasgvkcevcwsrxjpgaksxybqsofsxzsdeflphvzpzqioflitssplfheepdraeketdj","lrkykfzbqohzghvriwmwrtgptfdgwoclaehxujswufkmmuebvtozbhrjtpcmrwufrsjupoedgqsubbbvlbtkosrfdthrxbcq","cuvkc","qomgdgmepyktyexunnhirbqnarfdf","rmvppwtfmeteylqons","vdiqiavnkoxxqazrphttqhlevygfylfiyjkbmk","nbeawufkicbfhwdohjmhalwxvnexleiarewaklpyrleygvqftnmtwhpxcbiajearbckhydjstlvwfeywdwcu","fnwwldvonsrbqyfwecjclbodmzrgydejnsbshzbzosptoyugmvizkupntxffjzyijcjvnxhuzez","imqfboyfcmbzjduerhkitmpopdaroi","cukchstrkftlgefvyzpsujetytoebujmhwkipdgizdkipjcpvzzchqqrmqylmcszvemjbzgketpkzbrxguanvjbpxok","bvyuoyqyryyeviocouoxdckpotoaklhalkxppvxwvzaxwh","hkjlnprhizooehppsjxbsrbaxyuszevcukvoqffczvonstjiinxtwgzngctnkpbrpeohbxemlcjjgdlcvtfdodpqavcxftmnczk","twzzzushasnqjxzfdtizajegksbhljakizojgausnhkxdfrypiriwmrraqnrhloctrvukkqons","bizlpbpvdkcbcavxogrkaxmzbsujecqphusdxlhprrfokhbkgeapghdclkfgutfhkckoozolsyequrgnrndybvofuzca","uhlgrpshm","fffblhiue","uxfxwhhhzwubnpkshnetkvmokzsnalh","xzbqhsjmkkxkpreqdrooiifvkrxquxwlpytwbmespaqdknxcwfhnjesuwdujghoxznrlxelmi","ljbdlnpjvzbiywyjqmxdxbqiwqkkvqslfklugpzithhviczc","kqhattassqwlrxhpzaytmazlyfgvbglxgiqnrrghdjoclhhleqqlwdeblsviwkciqehcjypozryajlngeqrloxufpuryncat","kyptacgghycdhhnhmlndjaqsrtjudnhwixqvuamkaguagzacczyirfqarfuklvjf","tsuinonhxpreonbxzaztfeffdcymrxngqeuthmzojldodqlhpxpremc","bvejqokgmvsxfugorsldmalka","fxlloyqelywmhiwdtxvtttddthfzbajrgeznmxxgmwzvtmnnwjebeylwjspxygveswxtzefrfhlyhyyambt","wuhqhyxfpsoaoyssbjwjxqzhckfyfsvonlmyphloyoagoxycirdriaramwxsrswbxptxzvdjticaacwnx","vtgnhypjamsfxyvnzghqrmntherndth","fmavnsloegrtcibrbifuibqvjvusppgmprqmibm","prfyttezajzqbcccrhqdevnazibcpznkxouwegpbbapxlrmhkfhoihv","hoaerkgvqbhssdrujbrtmlvwbnhqx","ozerhqqdwfwduyxrjmtxrevbdtgmwpbhkxqjsnlssmestosukzlglqdfi","gthdnp","nukyujeknoixksgludcsmxbbsrqjbpnbtvuawtbihdo","xflmwpjo","eb","uujqhzyytjv","jgowebswpjsggcahajdxzlratrocfghnplpkabnzitmhfhwspgshvpamgqpilgortzvzuoexbaxcalxsxlzsdejgjgihulwxoabq","sytmzzwifklxsrpyldonjbqchisdjfhpmhzjea","eithdxqoyza","sqozuxpdhuaqttpwvyilgjtrtttlmeabuxacxhhjmxfpunzdmxeghuukyutlfkk","njsirzxawbzktvdyrhxzjkqgnipmjffsabonsdmkinjwqhmwngwcravsctcuglkk","dmbkpmbvcklftvucfzjfagowavptxbezhrnkrvnfhauhfrdnfnxuneznqnjlwxxyhfcxrq","cwdnifexgdpqqecqwktngwzqtqvbcywdphfxfnzoavileuflvkcnzirqdkpulrvmgjrqjblwfjdqacmwzytcqrxrspmlleolt"};String chars &#61; "owqugdlpqrnasodvbemfhuzctbibeboxgdklfyzyucomprzzoxwwxm";final int i &#61; countCharacters(words, chars);System.out.println("i &#61; " &#43; i);}/*** 思路三&#xff1a;* 93%* 有以下注意的点&#xff1a;* 1.使用字符串数组记录字符个数* 2.使用flag变量控制是否包含该字符串&#xff08;好像在哪里看到尽量不要使用label这种跳转的....&#xff09;* 3.如果字符串长度大于chars&#xff0c;可以不用比较&#xff0c;直接跳过* 4.可以一边遍历目标字符串&#xff0c;一边比较&#xff0c;可能会提前结束&#xff0c;不用再用一个for循环。** 作者&#xff1a;13217319563* 链接&#xff1a;https://leetcode-cn.com/problems/find-words-that-can-be-formed-by-characters/solution/javazhi-xing-5mschao-guo-93-by-13217319563/* 来源&#xff1a;力扣&#xff08;LeetCode&#xff09;* 著作权归作者所有。商业转载请联系作者获得授权&#xff0c;非商业转载请注明出处。* &#64;param words* &#64;param chars* &#64;return*/public static int countCharacters(String[] words, String chars) {int len &#61; 0;char[] cs &#61; new char[26];for (char c : chars.toCharArray()) {cs[c - &#39;a&#39;]&#43;&#43;;}for (String str : words) {boolean flag &#61; true;//如果长度大于chars数组,直接不用比较if (chars.length()
// public static int countCharacters(String[] words, String chars) {
// int[] chars_count &#61; count(chars); // 统计字母表的字母出现次数
// int res &#61; 0;
// for (String word : words) {
// int[] word_count &#61; count(word); // 统计单词的字母出现次数
// if (contains(chars_count, word_count)) {
// res &#43;&#61; word.length();
// }
// }
// return res;
// }
//
// // 检查字母表的字母出现次数是否覆盖单词的字母出现次数
// static boolean contains(int[] chars_count, int[] word_count) {
// for (int i &#61; 0; i <26; i&#43;&#43;) {
// if (chars_count[i]
// }
// }
// return true;
// }
//
// // 统计 26 个字母出现的次数
// static int[] count(String word) {
// int[] counter &#61; new int[26];
// for (int i &#61; 0; i
// counter[c-&#39;a&#39;]&#43;&#43;;
// }
// return counter;
// }/*** 思路一&#xff1a;使用两个map集合存储word与chars的每个字符出现次数&#xff0c;然后比对&#xff0c;如果存在字符出现在word中&#xff0c;而不出现在chars中&#xff0c;* 则返回0&#xff0c;如果存在word中的某字符数大于chars则返回0&#xff0c;否则返回word长度。* &#64;param words* &#64;param chars* &#64;return*/
// public static int countCharacters(String[] words, String chars) {
// int i,num &#61; 0;
// final Map getmap &#61; getmap(chars);
// System.out.println("charsmap &#61; " &#43; getmap);
// for (String word :words){
// num &#43;&#61; compare(word,getmap);
// }
// return num;
// }
// public static Map getmap(String str){
// int i;
// Map
// final String[] split &#61; str.split("");
// for (i &#61; 0;i
// charsmap.put(split[i],1);
// }else {
// Integer integer &#61; charsmap.get(split[i]);
// integer&#43;&#43;;
// charsmap.put(split[i],integer);
// }
// }
// return charsmap;
// }
// public static int compare(String word, Map
// final Map
// final Set set &#61; getmap.keySet();
//
// int i;
// if (!chars.keySet().containsAll(set)){
// return 0;
// }else {
// final Iterator iterator &#61; set.iterator();
// while (iterator.hasNext()){
// final Object next &#61; iterator.next();
// if (getmap.get(next) > chars.get(next)){
// return 0;
// }
// }
// }
// return word.length();
// }
}