Question: #include #include #include #include #include using namespace std; int main() { string str; getline(cin, str); unordered_map mp; mp[life] = zindagi, mp[complex] = mushkil, mp[mistakes] =
#include
#include
#include
#include
#include
using namespace std;
int main()
{
string str;
getline(cin, str);
unordered_map
mp["life"] = "zindagi", mp["complex"] = "mushkil", mp["mistakes"] = "ghaltiyan", mp["important"] = "zaroori", mp["stronger"] = "taqatwar";
mp["people"] = "log", mp["forever"] = "humeshah", mp["wait"] = "intazar", mp["hurt"] = "dukh mei", mp["help"] = "madad";
mp["alone"] = "akela", mp["world"] = "duniyan", mp["someone"] = "koi", mp["good"] = "achi", mp["thing"] = "cheez";
mp["human"] = "insan", mp["many"] = "bohat", mp["tired"] = "thakay", mp["they"] = "woh", mp["enough"] = "kafi", mp["house"] = "ghar", mp["some"] = "kuch"
, mp["stomach"] = "pait", mp["empty"] = "khali", mp["thankful"] = "shukar guzar";
string st = "";
for (int i = 0; i < str.size(); i++)
{
if ((str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z'))
st.push_back(str[i]);
else if (str[i] == ' ' || str[i] == '.' || str[i] == ',' || str[i] == '!' || str[i] == '?') {
string cpy = st;
if (st[0] >= 'a' && st[0] <= 'z')
st[0] -= 32;
if (mp.find(st) != mp.end())
{
string res = mp[st];
if (cpy[0] >= 'a' && cpy[0] <= 'z')
res[0] += 32;
cout << res;
}
else
cout << cpy;
cout << str[i];
st.clear();
}
}
return 0;
}
Life is not easy. It gets complex as time goes by. we make mistakes, we fall but what is important is that we rise stronger than ever. people come and go. They won't stay forever. We shouldnt not wait for them. People are hurt. We should help them as much as possible. alone person cannot fight the world alone. He needs someone by his side. It is in human nature. Forgiving people Is a good thing. many people are tired of living. They are working trying to make enough for their house. Some go to bed on empty stomach we should be thankful for what we have.
Above the code is not running and giving error
The dictionary is also given above....so find the error in code and make it possible to run
Solve it ASAP
I will give you thumb up
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
