{"id":124,"date":"2008-06-05T06:52:35","date_gmt":"2008-06-05T11:52:35","guid":{"rendered":"http:\/\/mariusbancila.ro\/blog\/?p=124"},"modified":"2008-06-05T06:52:42","modified_gmt":"2008-06-05T11:52:42","slug":"word-reducing-puzzle","status":"publish","type":"post","link":"https:\/\/mariusbancila.ro\/blog\/2008\/06\/05\/word-reducing-puzzle\/","title":{"rendered":"Word Reducing Puzzle"},"content":{"rendered":"<p>I recently found an interesting problem on the web, about reducing words, letter by letter until only one letter remains. Here is a formal definition:<\/p>\n<blockquote><p>\nWe define word reduction as removing a single letter from a word while leaving the remaining letters in their original order so that the resulting sequence of characters is also a word. A good word can be reduced step-by-step until all that is left is a or i. Your program will answer the question: what is the biggest word in the given dictionary that can be reduced?\n<\/p><\/blockquote>\n<p>A typical example, not very long is this:<\/p>\n<pre class=\"prettyprint\">\r\nplanets\r\nplants\r\npants\r\npant\r\nant\r\nan\r\na\r\n<\/pre>\n<p>So I though this could be a good exercise for F#. Several good dictionaries, both small and big, can be found <a href=\"http:\/\/cs.millersville.edu\/~katz\/cs362\/examples\/dictionaries\/\" target=\"_blank\">here<\/a>.<\/p>\n<p>My approach was to read the dictionary and build a list for each word length: one for 1-letter words, one for 2-letter words, etc. This could be a Dictionary&lt;int, list<string>&gt;, and let&#8217;s call it simply dictionary. Then these lists could be traversed and create a second set of lists (let&#8217;s call this reducedwords), but only with the words that meet the defined reduction.<\/p>\n<p>An good approach would be to take each list of words from the initial dictionary, starting with the list with words of 2 letters, and for each word to delete one letter at a time. Then check to see if the resulting word already exists in the list from reducedwords corresponding to a length smaller with 1. If it&#8217;s there, that this word could be reduced and should be added to the list from reducedwords corresponding to the current length. In other words, the algorithm would be:<\/p>\n<pre class=\"prettyprint\">\r\ncopy dictionary[1] to reducedwords[1]\r\n\r\nfor length = 2 to maxwordlength do\r\n  foreach word in dictionary[length]\r\n    foreach letter in word\r\n      * delete the letter\r\n      * if new word exists in reducedwords[length-1] then\r\n          * add new word to reducedwords[length]\r\n<\/pre>\n<p>Here is a function for reading a dictionary file:<\/p>\n<pre class=\"prettyprint\">\r\nlet readWords (filename:string) = \r\n   let dictionary = new Dictionary&lt; int, list&lt; string &gt; &gt;()\r\n   let reader = new StreamReader(filename)\r\n   let word = String.Empty\r\n   let fileend = ref false\r\n   while (!fileend = false) do\r\n      let word = reader.ReadLine()\r\n      if word = null then \r\n         fileend := true\r\n      else\r\n         let len = String.length word\r\n         let ok, words = dictionary.TryGetValue(len)\r\n         if ok then dictionary.[len] &lt;- words@[word]\r\n         else dictionary.[len] &lt;- [word]\r\n   done\r\n   dictionary.[1] &lt;- [\"a\";\"e\";\"i\";\"o\";\"u\"]\r\n   dictionary\r\n<\/pre>\n<p>One I have the dictionary read, I can apply the algorithm and generate a second Dictionary structure. The following function also returns length of the longest word(s) in the reduced dictionary. This is useful for printing.<\/p>\n<pre class=\"prettyprint\">\r\nlet findReducedWords (dictionary:Dictionary&lt; int, list&lt; string &gt; &gt;) =\r\n   let reducedwords = new Dictionary&lt; int, list&lt; string &gt; &gt;()\r\n   reducedwords.[1] &lt;- dictionary.[1]\r\n\r\n   let notdone = ref true\r\n   let i = ref 2\r\n   while (!notdone = true) do\r\n      let ok, words = dictionary.TryGetValue(!i)\r\n      if ok &lt;&gt; true then\r\n         notdone := false\r\n      else\r\n         let added = ref false\r\n         let ok, reducedpre = reducedwords.TryGetValue(!i - 1)\r\n         reducedwords.[!i] &lt;- []\r\n         words |&gt; List.iter (fun word -&gt;\r\n            for j = 0 to word.Length-1 do\r\n               let trimmedword = word.Remove(j, 1)\r\n               if reducedpre.Exists(fun x -&gt; x = trimmedword) then\r\n                  reducedwords.[!i] &lt;- reducedwords.[!i]@[word]\r\n                  added := true\r\n            done;\r\n         )\r\n         reducedwords.[!i] &lt;- reducedwords.[!i] |&gt; Set.of_list |&gt; List.of_seq\r\n         if !added then\r\n            i := !i + 1\r\n         else\r\n            reducedwords.Remove(!i) |&gt; ignore\r\n            notdone := false\r\n   done\r\n\r\n   (reducedwords, !i-1)\r\n<\/pre>\n<p>Since the problem is about printing only the longest such reductions, I&#8217;ll only consider starting from the list of reduced words that has the longest words. That&#8217;s why I needed findReducedWords to return the length of longest reducible word.<\/p>\n<p>To print these paths I apply the same algorithm as before. The only difference is that I build a list with the words in the reducing path, starting with the longest word and ending with a 1-letter word.<\/p>\n<pre class=\"prettyprint\">\r\nlet rec printSequence \r\n   (word:string) \r\n   (reducedwords:Dictionary&lt; int, list&lt; string &gt; &gt;) \r\n   (path:list&lt; string &gt;) =\r\n   match word.Length with\r\n   | 1 -&gt; \r\n      path@[word] |&gt; List.iter (fun x -&gt; printf \"%s \" x); \r\n      printfn \"\"\r\n   | _ -&gt; \r\n      let ok, reducedpre = reducedwords.TryGetValue(word.Length-1)\r\n      if ok then\r\n         for j = 0 to word.Length-1 do\r\n            let trimmedword = word.Remove(j, 1)\r\n            if reducedpre.Exists(fun x -&gt; x = trimmedword) then\r\n               printSequence trimmedword reducedwords (path@[word])\r\n         done;\r\n               \r\nlet printSequences \r\n   (reducedwords:Dictionary&lt; int, list&lt; string &gt; &gt;) \r\n   (maxlen:int) =\r\n   let ok, words = reducedwords.TryGetValue(maxlen)\r\n   if ok then      \r\n      words |&gt; List.iter (fun word -&gt; \r\n         printSequence word reducedwords [])\r\n<\/pre>\n<p>The only thing left to do is calling all these functions:<\/p>\n<pre class=\"prettyprint\">\r\nlet main()=\r\n   printfn \"reading dictionary...\"\r\n   let dictionary = readWords \"huge_dict.txt\"\r\n\r\n   printfn \"building structures...\"\r\n   let reducedwords, max = findReducedWords dictionary\r\n\r\n   printfn \"printing matches...\"\r\n   printSequences reducedwords max\r\n\r\n   Console.WriteLine(\"Press any key to continue...\")\r\n   Console.ReadKey()\r\n   \r\nmain()\r\n<\/pre>\n<p>My results for <a href=\"http:\/\/cs.millersville.edu\/~katz\/cs362\/examples\/dictionaries\/huge.dict\" target=\"_blank\">this dictionary<\/a> were:<\/p>\n<pre class=\"prettyprint\">\r\ncomplecting completing competing compting comping coping oping ping pig pi i\r\ncomplecting completing competing compting comping coping oping ping pin in i\r\ncomplecting completing competing compting comping coping oping ping pin pi i\r\n<\/pre>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently found an interesting problem on the web, about reducing words, letter by letter until only one letter remains. Here is a formal definition: We define word reduction as removing a single letter from a word while leaving the remaining letters in their original order so that the resulting sequence of characters is also &#8230; <a title=\"Word Reducing Puzzle\" class=\"read-more\" href=\"https:\/\/mariusbancila.ro\/blog\/2008\/06\/05\/word-reducing-puzzle\/\" aria-label=\"Read more about Word Reducing Puzzle\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","advgb_blocks_editor_width":"","advgb_blocks_columns_visual_guide":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[37,42],"tags":[],"class_list":["post-124","post","type-post","status-publish","format-standard","hentry","category-fsharp","category-parallel-programming"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Marius Bancila\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/mariusbancila.ro\/blog\/2008\/06\/05\/word-reducing-puzzle\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Marius Bancila&#039;s Blog | About code. Mostly on C++\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Word Reducing Puzzle\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/mariusbancila.ro\/blog\/2008\/06\/05\/word-reducing-puzzle\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2008-06-05T11:52:35+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2008-06-05T11:52:42+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Word Reducing Puzzle\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2008\\\/06\\\/05\\\/word-reducing-puzzle\\\/#article\",\"name\":\"Word Reducing Puzzle\",\"headline\":\"Word Reducing Puzzle\",\"author\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\"},\"datePublished\":\"2008-06-05T06:52:35+02:00\",\"dateModified\":\"2008-06-05T06:52:42+02:00\",\"inLanguage\":\"en-US\",\"commentCount\":1,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2008\\\/06\\\/05\\\/word-reducing-puzzle\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2008\\\/06\\\/05\\\/word-reducing-puzzle\\\/#webpage\"},\"articleSection\":\"F#, Parallel Programming\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2008\\\/06\\\/05\\\/word-reducing-puzzle\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/#listItem\",\"name\":\"IT\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/#listItem\",\"position\":2,\"name\":\"IT\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"name\":\"Software\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"position\":3,\"name\":\"Software\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/net\\\/#listItem\",\"name\":\".NET\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/#listItem\",\"name\":\"IT\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/net\\\/#listItem\",\"position\":4,\"name\":\".NET\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/net\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/net\\\/fsharp\\\/#listItem\",\"name\":\"F#\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"name\":\"Software\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/net\\\/fsharp\\\/#listItem\",\"position\":5,\"name\":\"F#\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/net\\\/fsharp\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2008\\\/06\\\/05\\\/word-reducing-puzzle\\\/#listItem\",\"name\":\"Word Reducing Puzzle\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/net\\\/#listItem\",\"name\":\".NET\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2008\\\/06\\\/05\\\/word-reducing-puzzle\\\/#listItem\",\"position\":6,\"name\":\"Word Reducing Puzzle\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/net\\\/fsharp\\\/#listItem\",\"name\":\"F#\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\",\"name\":\"Marius Bancila's Blog\",\"description\":\"About code. Mostly on C++\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/\",\"name\":\"Marius Bancila\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2008\\\/06\\\/05\\\/word-reducing-puzzle\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a84dd2831d955c38355ddea55df4df260809b88f36408bc14fd4eab8f7f131c9?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Marius Bancila\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2008\\\/06\\\/05\\\/word-reducing-puzzle\\\/#webpage\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2008\\\/06\\\/05\\\/word-reducing-puzzle\\\/\",\"name\":\"Word Reducing Puzzle\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2008\\\/06\\\/05\\\/word-reducing-puzzle\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"datePublished\":\"2008-06-05T06:52:35+02:00\",\"dateModified\":\"2008-06-05T06:52:42+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/\",\"name\":\"Marius Bancila's Blog\",\"description\":\"About code. Mostly on C++\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Word Reducing Puzzle","description":"","canonical_url":"https:\/\/mariusbancila.ro\/blog\/2008\/06\/05\/word-reducing-puzzle\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mariusbancila.ro\/blog\/2008\/06\/05\/word-reducing-puzzle\/#article","name":"Word Reducing Puzzle","headline":"Word Reducing Puzzle","author":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"publisher":{"@id":"https:\/\/mariusbancila.ro\/blog\/#organization"},"datePublished":"2008-06-05T06:52:35+02:00","dateModified":"2008-06-05T06:52:42+02:00","inLanguage":"en-US","commentCount":1,"mainEntityOfPage":{"@id":"https:\/\/mariusbancila.ro\/blog\/2008\/06\/05\/word-reducing-puzzle\/#webpage"},"isPartOf":{"@id":"https:\/\/mariusbancila.ro\/blog\/2008\/06\/05\/word-reducing-puzzle\/#webpage"},"articleSection":"F#, Parallel Programming"},{"@type":"BreadcrumbList","@id":"https:\/\/mariusbancila.ro\/blog\/2008\/06\/05\/word-reducing-puzzle\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog#listItem","position":1,"name":"Home","item":"https:\/\/mariusbancila.ro\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/#listItem","name":"IT"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/#listItem","position":2,"name":"IT","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","name":"Software"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","position":3,"name":"Software","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/net\/#listItem","name":".NET"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/#listItem","name":"IT"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/net\/#listItem","position":4,"name":".NET","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/net\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/net\/fsharp\/#listItem","name":"F#"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","name":"Software"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/net\/fsharp\/#listItem","position":5,"name":"F#","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/net\/fsharp\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/2008\/06\/05\/word-reducing-puzzle\/#listItem","name":"Word Reducing Puzzle"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/net\/#listItem","name":".NET"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/2008\/06\/05\/word-reducing-puzzle\/#listItem","position":6,"name":"Word Reducing Puzzle","previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/net\/fsharp\/#listItem","name":"F#"}}]},{"@type":"Organization","@id":"https:\/\/mariusbancila.ro\/blog\/#organization","name":"Marius Bancila's Blog","description":"About code. Mostly on C++","url":"https:\/\/mariusbancila.ro\/blog\/"},{"@type":"Person","@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author","url":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/","name":"Marius Bancila","image":{"@type":"ImageObject","@id":"https:\/\/mariusbancila.ro\/blog\/2008\/06\/05\/word-reducing-puzzle\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/a84dd2831d955c38355ddea55df4df260809b88f36408bc14fd4eab8f7f131c9?s=96&d=mm&r=g","width":96,"height":96,"caption":"Marius Bancila"}},{"@type":"WebPage","@id":"https:\/\/mariusbancila.ro\/blog\/2008\/06\/05\/word-reducing-puzzle\/#webpage","url":"https:\/\/mariusbancila.ro\/blog\/2008\/06\/05\/word-reducing-puzzle\/","name":"Word Reducing Puzzle","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/mariusbancila.ro\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/mariusbancila.ro\/blog\/2008\/06\/05\/word-reducing-puzzle\/#breadcrumblist"},"author":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"creator":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"datePublished":"2008-06-05T06:52:35+02:00","dateModified":"2008-06-05T06:52:42+02:00"},{"@type":"WebSite","@id":"https:\/\/mariusbancila.ro\/blog\/#website","url":"https:\/\/mariusbancila.ro\/blog\/","name":"Marius Bancila's Blog","description":"About code. Mostly on C++","inLanguage":"en-US","publisher":{"@id":"https:\/\/mariusbancila.ro\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Marius Bancila's Blog | About code. Mostly on C++","og:type":"article","og:title":"Word Reducing Puzzle","og:url":"https:\/\/mariusbancila.ro\/blog\/2008\/06\/05\/word-reducing-puzzle\/","article:published_time":"2008-06-05T11:52:35+00:00","article:modified_time":"2008-06-05T11:52:42+00:00","twitter:card":"summary","twitter:title":"Word Reducing Puzzle"},"aioseo_meta_data":{"post_id":"124","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-03-18 21:13:46","updated":"2025-12-12 07:19:10","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"author_meta":{"display_name":"Marius Bancila","author_link":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/"},"featured_img":null,"jetpack_publicize_connections":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Marius Bancila","author_link":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/"},"uagb_comment_info":1,"uagb_excerpt":"I recently found an interesting problem on the web, about reducing words, letter by letter until only one letter remains. Here is a formal definition: We define word reduction as removing a single letter from a word while leaving the remaining letters in their original order so that the resulting sequence of characters is also&hellip;","coauthors":[],"tax_additional":{"categories":{"linked":["<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/net\/fsharp\/\" class=\"advgb-post-tax-term\">F#<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/parallel-programming\/\" class=\"advgb-post-tax-term\">Parallel Programming<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">F#<\/span>","<span class=\"advgb-post-tax-term\">Parallel Programming<\/span>"]}},"comment_count":"1","relative_dates":{"created":"Posted 18 years ago","modified":"Updated 18 years ago"},"absolute_dates":{"created":"Posted on June 5, 2008","modified":"Updated on June 5, 2008"},"absolute_dates_time":{"created":"Posted on June 5, 2008 6:52 am","modified":"Updated on June 5, 2008 6:52 am"},"featured_img_caption":"","series_order":"","jetpack_shortlink":"https:\/\/wp.me\/pYNdv-20","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/124","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/comments?post=124"}],"version-history":[{"count":0,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/124\/revisions"}],"wp:attachment":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/media?parent=124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/categories?post=124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/tags?post=124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}