I have a program that takes in a string and formats it, ridding it of symbols and setting the case to lower so that it can be processed.
"Man, this is super trippy!" -> "man this is super trippy"
"YOU are entering a NEW dimension!" -> "you are entering a new dimenstion"
"Wait a minute -- this is too groovy!" -> "wait a minute this is too groovy"
"TONIGHT -- we DINE IN hell!" -> "tonight we dine in hell"
line.erase(remove(line.begin(), line.end(), toExclude[i]), line.end());
transform(line.begin(), line.end(), line.begin(), tolower);
Since my program works fine up until I get to strings with hyphens in between words, is there a way to ensure that the maximum whitespaces between words remains at 1?
Yes: instead of processing the input string using erase-remove and transform, consider reading the input string using an input string stream (I will not post any code as this was requested by your professor :) ).