C# exercises - Part 2

It's time for a little text analysis! These C# functions analyze a section of Chapter 1 of Alice in Wonderland. Click the "View Code" button to see exactly how each one is written.

Find Longest Word view code

Task: Write a function findLongestWord() that finds and displays the longest word in a document's text.

waistcoat-pocket

Filter Words on Word Length view code

Task: Write a function filterLongWords() that finds and displays all words that are longer than a given integer i. Do not display words more than once.

Words longer than 6 characters: beginning, sitting, nothing, reading, pictures, conversations, thought, without

Word Frequency view code

Task: Write a function wordFreq() that displays a frequency listing of the words contained in the document text. Order words by frequency.

Words that occur 1 time
grand   heap   truth   tell   now   earnestly   walking   dream   dozing   felt   matter   question   sticks   answer   sometimes   dreamy   mouse   catch   afraid   i'm   mice   are   tea-time   milk   saucer   couldn't   hope   dry   bit   middle   sadly   walked   every   trying   side   been   locked   roof   hanging   lamps   leaves   row   longer   whiskers   ears   wind   away   lost   hurrying   sight   overhead   jumped   hurt   lit   wondering   cat   to-night   heads   walk   seem   funny   presently   toast   idea   distancebut   yes   practice   listen   downward   knowledge   opportunity   though   schoolroom   lessons   learnt   thousand   four   let   centre   near   must   showing   should   antipathies   listening   miss   dinah'll   talking   else   written   perhaps   asking   she'll   girl   ignorant   manage   glad   you're   spokefancy   curtsey   australia   zealand   new   ma'am   please   country   name   word   sound   curtseying   aloud   three-legged   glass   will   poker   red-hot   taught   friends   simple   because   unpleasant   beasts   wild   eaten   burn   burnt   children   histories   read   i'll   hurry   wise   letters   printed   beautifully   label   paper   who   neck   hold   your   buttered   toffee   turkey   roast   pine-apple   custard   cherry-tart   flavour   mixed   fact   finding   cut   taste   later   sooner   disagree   certain   almost   forgotten   bleeds   usually   knife   deeply   finger   ventured   solid   certainly   shutting   garden   loveliest   along   knelt   rat-hole   than   larger   led   opened   fitted   delight   longed   lock   inches   fifteen   curtain   second   open   locks   alas   belong   alice's   tiny   except   high   telescopes   wander   bright   find   hoping   half   back   waiting   impossible   really   indeed   few   lately   happened   beds   out-of-the-way   knew   only   telescope   shut   shoulders   poor   go   doorway   fountains   cool   flowers   begin   fallen   finished   fortunately   trouble   slowly   plenty   worth   daisy-chain   making   pleasure   happen   next   stupid   feel   make   natural   day   sides   filled   book-shelves   maps   hung   own   pegs   shelves   passed   labelled   orange   picking   marmalade'   stopping   dipped   actually   its   hurried   started   flashed   wondered   ought   take   burning   curiosity   field   occurred   afterwards   pop   itself   under   hedge   nor   remarkable   world   straight   eyes   pink   tunnel   some   daisies   disappointment   coming   quite   likely   tired   sitting   reading   tumbling   stairs   house   brave   top   bank   having   peeped   wouldn't   twice   home   true   past   beginning   why   killing   somebody   managed   drop   end   fear   empty  
Words that occur 2 times
close   miles   sister   many   watch   rabbit-hole   took   golden   hear   those   turned   good   head   small   once   corner   waistcoat-pocket   feet   seemed   across   however   other   earth   seen   have   come   late   doors   ran   rate   several   low   i've   table   behind   it's   somewhere   an   that's   still   thump   among   remember   made   people   anything   noticed   hot   soon   their   it'll   cupboards   saw   mind   rather   air   jar   considering   without   didn't   ask   know   put   sleepy   such   conversations   hand   white   begun   they'll   latitude   falling   deep   wish   got   saying   longitude   great   rules   words   bat   going   whether  
Words that occur 3 times
use   pictures   drink   did   dear   any   getting   poison   book   over   marked   said   first   ever   came   look   might   tried   another   dark   long   passage   fell   from   them   large   after   round   began   sort   nice   just   right   even  
Words that occur 4 times
fall   bats   cats   which   things   bottle   off   key   too   into   dinah   they   here   upon   through   is   my   found   looked   again   then   door   oh   moment   hall  
Words that occur 5 times
way   much   suddenly   wonder   shall   eat   before   nothing   never   herself   either   could  
Words that occur 6 times
well   thought   one   by   say   get   when   like   rabbit   went  
Words that occur 7 times
were   if   what   would   about  
Words that occur 8 times
see   me   time   be   out  
Words that occur 9 times
so   how   do   little   no   this   up   at  
Words that occur 10 times
on   there   with   all  
Words that occur 11 times
think  
Words that occur 12 times
for   or  
Words that occur 13 times
as  
Words that occur 14 times
not  
Words that occur 16 times
you   but  
Words that occur 17 times
had  
Words that occur 18 times
very   that  
Words that occur 19 times
her  
Words that occur 20 times
in   alice  
Words that occur 21 times
down  
Words that occur 22 times
i  
Words that occur 33 times
of  
Words that occur 40 times
a  
Words that occur 43 times
was  
Words that occur 48 times
it   and  
Words that occur 52 times
she   to  
Words that occur 66 times
the  

Counting Alice view code

Task: Write a function that returns the total number of occurences of the word Alice in the document text, including variations of the word.

The word Alice occurs 21 times