Preview:
class Solution {
public:
    string firstPalindrome(vector<string>& words) {
        int n=words.size();
        
        string temp="";
        for(int i=0;i<n;i++)
        {
            temp="";
            int n1=words[i].size();
            temp=words[i];
            for(int j=0;j<n1/2;j++)
            {
                swap(temp[j],temp[n1-j-1]);
            }
            if(temp==words[i])
            {
               return words[i];
            }
            else temp="";
        }
    return temp;
    }
};
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter