Sponsored Content
Full Discussion: Word ladder Problem
Top Forums UNIX for Beginners Questions & Answers Word ladder Problem Post 303015320 by asak on Tuesday 3rd of April 2018 11:42:57 AM
Old 04-03-2018
Word ladder Problem

Perl - Script

Rules
In a Word Ladder:

Players get a starting word and an ending word
Starting and ending words must be the same length (PIG and HOG, or CAT and DOG)
Players change one letter at a time, attempting to move from the starting word to the ending word
Each intermediate step must be a valid word, and no proper nouns allowed!
Examples
Here are a few samples. Note that each step is a word and changes only one letter from the previous word.

FLY to CRY
Get from FLY to CRY in one step.

FLY
FRY (l → r)
CRY (f → c)
CAT to DOG
Turn a CAT into a DOG in two steps.

CAT
COT (a → o)
DOT (c → d)
DOG (t → g)

Note: Without using any modules.

Regards,
asak.

---------- Post updated 04-03-18 at 10:42 AM ---------- Previous update was 04-02-18 at 07:32 PM ----------

any solutions?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can a shell script pull the first word (or nth word) off each line of a text file?

Greetings. I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file. I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies

2. UNIX for Dummies Questions & Answers

Word count problem

I have a text file that has 5719 rows when I open it up in a text editor. When I do a wc -l in Unix however, it says that I have 5718 rows. What could be causing this difference? (1 Reply)
Discussion started by: ssmith001
1 Replies

3. UNIX for Dummies Questions & Answers

word too long..problem while sourcing .cshrc

I am setting my PATH & LD_LIBRARY_PATH through .cshrc file while sourcing it on a old shell i am getting the error word too long .and the changes which i anm doing doesn't get updated . i am in a multi user environment so the only way to do the changes only for my shell is to do it that way. ... (1 Reply)
Discussion started by: mobydick
1 Replies

4. Homework & Coursework Questions

word ordering problem HELP please (linux)

Hi guys I need you ,please help me i have to do this for tomorow and i don't understand how to do Q1 : Order the words of RADIO.txt by frequency Q2 : Order the words of RADIO.txt in alphabétique order Q3 : Order the words of RADIO.txt par ordre "rhymique" (exemple, put togeder words which are... (1 Reply)
Discussion started by: Lili
1 Replies

5. Shell Programming and Scripting

Remove specific word from data contents problem asking

Hi, Below is my input file: >tempZ_1 SAFSDAFDSG GGERRTTZZZ ZASRARARET WETPOASDAZ ZZZASASFAS >temp_9 ASAEGPIOEO EIOPIZZZAS FDFGZZZARA ESEAZZZAAS . . Desired output file: (9 Replies)
Discussion started by: patrick87
9 Replies

6. Shell Programming and Scripting

Exclude specific word from input file problem asking...

Hi, Below is my input file and desired output file: Input file: >header_N_1 ASFDGDGNDGEGWETWRYWTETWNETOWETWETWNETTETNWET . . Desired output file: >header_N_1 ASFDGDGDGEGWETWRYWTETWETOWETWETWETTETWET . . From the input file, I just hope to exclude the 'N' word from its content... (5 Replies)
Discussion started by: patrick87
5 Replies

7. Shell Programming and Scripting

Perl code- word count problem

Hi, I am having .csv files contains some row - Info: Value of field name 'SecurityExchange' is not supported ","Original Order Tuple Please see the below perl code carefully- /Info: (+),Original (\w+) Tuple/ and do { ($category, $type) = ($1, $2); if($type eq 'Execution')... (1 Reply)
Discussion started by: pspriyanka
1 Replies

8. Shell Programming and Scripting

problem removing a word from a file in vi

lets say i have a file named ex1 which contain an essay. (a) delete the word "benefit" from the file (b) delete the last 6 characters on each line for the first problem i entered :g/benefit/d but it deletes the whole line please help (3 Replies)
Discussion started by: koricha
3 Replies

9. UNIX for Dummies Questions & Answers

Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word

I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL. I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies

10. Shell Programming and Scripting

Snake and ladder game

Hi, I am designing snake and ladder game in unix. I am writing my script in bash shell in Solaris version. This game is designed by me for which I would like to give access to two players. When these players execute the game, there should be communication between the three participants(game... (7 Replies)
Discussion started by: ayarlaga
7 Replies
PPI::Token::Word(3)					User Contributed Perl Documentation				       PPI::Token::Word(3)

NAME
PPI::Token::Word - The generic "word" Token INHERITANCE
PPI::Token::Word isa PPI::Token isa PPI::Element DESCRIPTION
A "PPI::Token::Word" object is a PPI-specific representation of several different types of word-like things, and is one of the most common Token classes found in typical documents. Specifically, it includes not only barewords, but also any other valid Perl identifier including non-operator keywords and core functions, and any include "::" separators inside it, as long as it fits the format of a class, function, etc. METHODS
There are no methods available for "PPI::Token::Word" beyond those provided by its PPI::Token and PPI::Element parent classes. We expect to add additional methods to help further resolve a Word as a function, method, etc over time. If you need such a thing right now, look at Perl::Critic::Utils. literal Returns the value of the Word as a string. This assumes (often incorrectly) that the Word is a bareword and not a function, method, keyword, etc. This differs from "content" because "Foo'Bar" expands to "Foo::Bar". method_call Answers whether this is the name of a method in a method call. Returns true if yes, false if no, and nothing if unknown. TO DO
- Add "function", "method" etc detector methods SUPPORT
See the support section in the main module. AUTHOR
Adam Kennedy <adamk@cpan.org> COPYRIGHT
Copyright 2001 - 2011 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.16.3 2011-02-26 PPI::Token::Word(3)
All times are GMT -4. The time now is 08:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy