You are on page 1of 2

Anagrams

--------
Maximum execution time for this program : 6 sec

Two words are considered anagrams if all the second word can be
derived simply by rearranging the letters of the first word. For
example stop and post are anagrams since rearranging words in stop
can result in post.
Objective of this program is to find single word anagrams of 4 letters
or above in the given file. Given file may contain many anagram words.
Notes on the output format:
=> No spaces after comma
=> Output is case sensitive
=> all the words should be listed in the output starting with anagrams
that have least number of words in the file
=> Words in each line should be in sorted order.
=> if two or more lines have same number of words, then lines should be sorted
based on first word

For the sample1.txt in this directory here is the expected output:


Command to Run
--------------
sh run.sh sample1.txt
Expected Output
---------------
Read,dear
Rome,more
post,pots,stop

Hyphenize
---------
Max Execution Time: 3 Secs
Objective of the program is to find increasing and decreasing patterns in the
given input and Hyphenize it based on the sequence found. the sequence can be of
intervel 1,2,3
For example: abcde
can be hyphenized as a-e with an interval of 1.
acdf
can be hyphenized as a-f with an interval of 2.
Hyphenization should work for lower, capital and digits. For example NO need
to recognize 101112 as a sequence of 10-12. However 01234 should be recognized
as 0-4. At the same time 89:; should NOT be recognized as 8-; Similar lower and
upper case bounds should be honored.
Your program should recognize both increasing and decreasing sequences. I.e. a
string sequence of abcdefFEDCBA should be recognized as a-fF-A properly.
A sequence of ABCDEDCBA should be recognized as A-EE-A properly as well.
3 Makes a sequence, not 2
(NOTE: IF PARTIAL SCORING IS ALLOWED IN THE TEST, RECOGNIZING AT LEAST
ONE DIRECTION WILL GIVE YOU PARTIAL SCORE)
Here a-f$1 denotes a-f is a sequence with interval of 1 character
-----------------------------------------
Sample Input Sample Output
-----------------------------------------
abcdef a-f$1
abcdef9812312345 a-f$1981-3$11-5$1
10111234 10111-4$1
abcdefFEDCBA a-f$1F-A$1
ABCDEDCBA A-E$1E-A$1
ABCDEDCBAFHJL A-E$1E-A$1F-L$2
-------------------------------------------

You might also like