My homework assignment is to read a file, store in target words (delimited by #) and replacement words (also delimited by #) and original strings (they do not have #).
Also I could not assume max str length, or max # of words.
For example:
#uic#e# // uic = target string e = replacement string
juice // find substring "uic" and replace it with 'e' resulting in "jee"
quicken // qeken
quiche // qehe
uicuicuick // eeek
#pp## // pp = target string nothing = replacement string
apples //ales
copper // coer
bopped //boed
#t#tttttt# // t = target string tttttt = replacement string
tut tut // ttttttutttttt ttttttutttttt
tttttttttttttttttttttttttttttttttttttttttttttttttttt // last string =
//# of t's * 6
I've done EVERYTHING besides figuring out how to use the target string w/the replacement string. Is it possible to do it with strstr
? I know it points to the first occurrence but is it possible to make it point to every occurrence in a string? Please show me using pseudocode. Thank you!