/* The following program deletes every occurance 
 of string s2 in string s1. Here we ignore case.
*/
#include <iostream>
#include <string>
using namespace std;
string toupper(string s);
int main()
{
	int n2, i, pos, count = 0;
	string t1, t2, s1, s2, s3 = "";
	cout << "Enter a string: " << endl;
	//cin >> s1;
	getline(cin,s1);
	cout << "Enter another string to delete from the first string: " 
<< endl;
	cin >> s2;
	n2 = s2.size();

	t2=toupper(s2);

	i = 0;
	while (i < s1.size()) // Note the size of s1 may keep changing
	{
		t1 = toupper(s1);
		pos = t1.find(t2);
		if (pos >= 0 && pos < s1.size())
		{
			s1.replace(pos,n2,s3);
			//count++;
		}
		i++;
	}
	//cout << count << endl;
	cout << "The new string is: " << endl;
	cout << s1 << endl;
	return 0;
}

string toupper(string s)
{
	int i, n = s.size();
	for (i = 0; i < n; i++)
		s[i] = toupper(s[i]);
	return s;
}
