O(n) easy solution

#include <bits/stdc++.h>
using namespace std;
#include <chrono> 
#ifndef mehul
#pragma GCC optimize("Ofast")

typedef long long ll;
typedef unordered_map<int, int> umapii;
typedef unordered_map<int, bool> umapib;
typedef unordered_map<string, int> umapsi;
typedef unordered_map<string, string> umapss;
typedef map<string, int> mapsi;
typedef map<pair<int, int>, int> mappiii;
typedef map<int, int> mapii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef unordered_set<int> useti;

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define uset unordered_set
#define it iterator
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define f first
#define s second

#define INF 4557430888798830399ll
#define MOD 1000000007
#define EPS 1e-7
#define PI acos(-1)

#define sz(x) (int)(x).size()
#define fr(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define rep(i, n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define frr(i, a, b) for (int i = (a), _b = (b); i >= _b; i--)
#define trav(a, x) for(auto& a : x)
#define fil(ar, val) memset(ar, val, sizeof(ar))  // 0x3f for inf, 0x80 for -INF can also use with pairs

// A function to check if a string str is palindrome 
bool isPalindrome(string str, int l, int h) 
    // l and h are leftmost and rightmost corners of str 
    // Keep comparing characters while they are same 
    while (h > l) 
        if (str[l++] != str[h--]) 
            return false; 
    return true; 

int Solution::anytwo(string A) {
    //Remove the non repeating characters and check if the remaining string is a palindrome
    //If Palindrome ----> Return 0 (But check for special case like "AAAAA")
    //Else----> Return 1;
	unordered_map<char, int> m1;
	rep(i, A.size()){
		    return 1;
	string s;
	trav(c, A){
		if (m1[c]>1)

	if (isPalindrome(s, 0, s.size()-1))
		//Odd length -----> Special Case (eg "AAAAA")----->Palindrome but hasRepeats
		if (s.size() & 1) 
            return s[s.size()/2] == s[s.size()/2 - 1]; 
        // return false if string is a palindrome 
        return false; 

	return true;