Can Someone explain what this code does ? This is a solution for LAPIN problem

#include <iostream
#include <string>

using namespace std;

int main()
{
int t;
cin >> t;

while(t--)
{
    string s;
    cin >> s;
    
    int n = s.length();
    
    int fq[26] = {};
    for(int i=0; i<n/2; i++)
    ++fq[s[i]-'a'], --fq[s[n-1-i]-'a']; 
    
    bool f = true;
    for(int i=0; i<26; i++)
    if(fq[i]) 
    {
        f = false;
        break;
    }
    cout << ((f) ? "YES" : "NO") << "\n";
}

return 0;

}

You want same amount of alphabets in both the halves. Like if you got 2 'a’s in first half then it should be 2 'a’s in the other half too.

For loop runs simultaneously in both ends. First half increments the character count, while other half decrements the character count.

If for each character, the final value is 0, the two halfs are lapindromes.