News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

delete repeated letters

Started by kappa, February 06, 2011, 11:58:07 PM

Previous topic - Next topic

kappa

Hi, I'm new to this forum and to the assembly, so hello everyone. My problem is this: I want to delete, repeated letters from the given string (eg, hello), and then add this string to the existing array. I think I need to copy character by character to another variable and check (iterating through a string) that the letters are not repeated. The second issue is to copy string letter by letter and add this to the array. Unfortunately, my current knowledge of the assembler does not allow me to code this. I will be grateful for any tips and code examples.

Slugsnack

You don't want to search through any structure for existing letters. It will take a long time and complexity becomes very bad for long passages. Set up a bitmaps of bytes representing all possible characters. Each dword would have 32 possible characters then. Initialize them all to 0 and iterate through your original string. For each character do a bitmap mask check to see if that 'flag' is set. If no, add to new array and set flag. If yes, move to next char. At the end print out your array.