#include #include #include "MyString.h" MyString::MyString(string s){ this->s = s; } void MyString::setS(string str){ this->s = str; } string MyString::getS(){ return s; } MyString MyString::removePunctuation(){ string result; remove_copy_if(s.begin(), s.end(), back_inserter(result), std::ptr_fun(ispunct)); return MyString(result); } MyString MyString::toUpper(){ string temp = this->s; transform(temp.begin(), temp.end(), temp.begin(),::toupper); return MyString(temp); } MyString MyString::reverse(){ string temp = this->s; int n = temp.length(); for (int i = 0; i < n/2; i++) swap(temp[i], temp[n-i-1]); return MyString(temp); } MyString MyString::toMirror(){ string str = this->s; for(int i=0; is; int n = str.size(); bool palCheckTab[n][n]; for(int i = 0; i maxLength) { start = i; maxLength = k; } } } } str = str.substr(start, maxLength); return MyString(str); } void MyString::checkStringType(){ map M; for(int i=0; is; int n = str.size(); for(int i=0; i<=n/2; i++){ if(str[i] != str[n-i-1]){ palin = false; } if(str[n-i-1] != M[str[i]]){ mirror = false; } } if(palin && mirror){ cout << "Both" << endl; }else if(palin && !mirror){ cout << "Normal" << endl; }else if(!palin && mirror){ cout << "Mirror" << endl; }else{ cout << "Neither" << endl; } }