/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, OCaml, VB, Perl, Swift, Prolog, Javascript, Pascal, COBOL, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
std::string MakeStringGreatAgain(std::string s)
{
std::string str;
for(int i=0; i<s.size(); ++i)
{
if (str.size() && (abs(s[i] - str.back()) == 32))
str.pop_back();
else
str.push_back(s[i]);
}
return str;
}
int main()
{
std::cout << "unileEecs: " << MakeStringGreatAgain("unileEecs") << std::endl;
std::cout << "unileeecs: " << MakeStringGreatAgain("unileeecs") << std::endl;
std::cout << "unilEEEcs: " << MakeStringGreatAgain("unilEEEcs") << std::endl;
std::cout << "abBAcC: " << MakeStringGreatAgain("abBAcC") << std::endl;
std::cout << "a: " << MakeStringGreatAgain("a") << std::endl;
std::cout << ": " << MakeStringGreatAgain("") << std::endl;
return 0;
}