fstream mfile;
string word = "";
string remove_space="";
char c;
//reading from the file
mfile.open("pin.txt");//reading from the file
if (mfile.is_open())
{
while (!mfile.eof())
{
mfile.get(c);
//concatenating the data from file into string
word = word + c;
}
}
for (int i = 0; word[i]; i++)
{
if (word[i] != ' ')
remove_space = remove_space + word[i];
}
// spaces between words are removed but newline spaces are remain
cout << remove_space;