₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,149 members, 8,420,562 topics. Date: Friday, 05 June 2026 at 01:53 AM

Toggle theme

Programming Challenge - Programming (3) - Nairaland

Nairaland ForumScience/TechnologyProgrammingProgramming Challenge (3917 Views)

1 2 3 Reply (Go Down)

Re: Programming Challenge by jacob05(m): 10:45am On Sep 28, 2012
Re: Programming Challenge by PrinceNN(op): 5:25pm On Sep 29, 2012
jacob05: php 2 lines

you can save it in an index file =>index.php

and
query it with the string
index.php?string=The Quick Brown Fox Jumps Over The Lazy Dog

list($alph,$search) = array("abcdefghijklmnopqrstuvwxyz",$_GET['string']);
for($i=0;$i<strlen($alph);$i++) printf("%s %s's <br />",preg_match_all('/'.$alph{$i}.'/',$search,$match),$alph{$i});
Your code isnt complete, as it does not convert the input to lower case to be tested against $alph
notice how it says 0 f's and 0 d's...
and the output should follow the format No f's instead of 0 f's
proof: http://ideone.com/Jk7JH
Re: Programming Challenge by PrinceNN(op): 5:37pm On Sep 29, 2012
csharpjava: Oya make we see if no be the Java, Python etc loving guys go leave the bar with a black eye grin !
ok first of all, " " (ie space) isnt a letter so it shouldn't print the occurence
secondly, its supposed to print the occurence of all the letters from a-z
thirdly the challenge has a format for output...
so i guess mr c# don enter one chance
Re: Programming Challenge by jacob05(m):
₱®ÌИСΞ:
Your code isnt complete, as it does not convert the input to lower case to be tested against $alph
notice how it says 0 f's and 0 d's...
and the output should follow the format No f's instead of 0 f's
proof: http://ideone.com/Jk7JH
list($alph,$search) = array("abcdefghijklmnopqrstuvwxyz",strtolower($_GET['string']));
for($i=0;$i<strlen($alph);$i++) printf("%s %s's <br />",($result=preg_match_all('/'.$alph{$i}.'/',$search,$match)) ? $result : "No ",$alph{$i});
Re: Programming Challenge by jacob05(m): 6:42pm On Sep 29, 2012
Re: Programming Challenge by csharpjava(m): 9:18pm On Sep 29, 2012
₱®ÌИСΞ:
ok first of all, " " (ie space) isnt a letter so it shouldn't print the occurence
secondly, its supposed to print the occurence of all the letters from a-z
thirdly the challenge has a format for output...
No 1: Has been fixed with Regular Expressions http://london.gs.aster.arvixe.com/default.aspx
Nos 2 & 3: Work is in progress.

Credit should have been given for mine being available online for anyone to try.
Re: Programming Challenge by jacob05(m): 9:26pm On Sep 29, 2012
Final fix done {still 2 lines == 2 semi colon wink} http://pastebin.com/nKsEq9tN
Re: Programming Challenge by mkwayisi: 10:02pm On Sep 29, 2012
jacob05: Final fix done {still 2 lines == 2 semi colon wink} http://pastebin.com/nKsEq9tN
The fun don finish ;-)
Re: Programming Challenge by jacob05(m): 10:48pm On Sep 29, 2012
mkwayisi: The fun don finish ;-)
think it's just beginning wink.
1 2 3 Reply

Programming Challenge For Beginners Competition Two N20000 -SEASON 2-Programming Challenge For Beginners N20000Facebook Programming Challenge Question234

Is Main Function In C/c++ User Defined Function Or Predefined Function?Ways To Easily Get Content For Your Blog Or WebsiteCreative Skills To Improve Your Essay Writing