Complex String Manipulation program
Posted on 2009-05-25
I need the help with the logic for below program -
there is a txt file containg some data on each line as follow:
First line: T (i.e.Number of test cases)
Secod line : M (i.e. Number of words or lines to follow ion each case)
Third onwards: String data in lower letters only..
like the txt file above.
Now the logic need to read the file and if the start letter of a word is end letter of some other word in the same test case.then the output true or else false.
Like in above example there are 2 test cases and 3 strings in 1st case, namely 'map','manip', and 'hashcode'.The last case has 4 strings.
If the words in each test case can be arranged like
deltas szeta alphag gamma
i.e. the start of each string is the end of some other and they can be arranged in the series like above!then its true otherwise false.
If can get the help for for both C++ and java it wil be nice
Thanks & regards,