From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: Re: How to check if letters are in a string? Date: Sat, 18 Jul 2015 05:23:54 -0500 Organization: Aioe.org NNTP Server Message-ID: References: <53a16384-fa63-479c-9421-553683dd6009@googlegroups.com> Reply-To: nma@12000.org NNTP-Posting-Host: 8NUpq80EOZpQMEPcD5V8pw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:26869 Date: 2015-07-18T05:23:54-05:00 List-Id: On 7/18/2015 4:00 AM, Trish Cayetano wrote: > Hi, > > How do you check if (exact number of) letters are in a string? > > 1. This example should PASS because every letter is found in the string > LETTERS: HID > STRING: HIDDEN > I do not follow. The 'D' in 'letters' occur 1 time but it occurs 2 times in 'string'. So this is not the _exact number_ of letters in the string. > 2. This example should FAIL because the letters contain 2 N's but the string only has 1 N. > LETTERS: NINE > STRING: HIDDEN > So why now this fails when 'letters' has more N's than in string, but the first case did not fail when 'letters' had less D's than in string? I think your problem specifications is not clear. --Nasser