Question: Amadeus, Online Assessment Question | Mirror Personalities | Computer Crash | 18th September 2023
0
Entering edit mode

ADD COMMENTlink 15 months ago Delta 2.9k
2
Entering edit mode

#include <bits/stdc++.h>
#include <algorithm>
#include <stack>
using namespace std;
#define pb push_back
#define ll long long int
#define MAXN 1000001
#define MOD 1000000007


int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int freq[26] = {0};
    for (int i = 0; i < n; i++)
    {
        freq[s[i] - 'a']++;
    }
    int ans = 0;
    for (int i = 0; i < 26; i++)
    {
        ans += (freq[i] * freq[25 - i]);
    }
    cout << (ans / 2) << endl;


    return 0;
}

ADD COMMENTlink 13 months ago mg2002 • 40
0
Entering edit mode

Bhai OA ka pattern kya tha , mcq kis subjects se the??

ADD COMMENTlink 13 months ago Rishabh • 0

Login before adding your answer.

Similar Posts
Loading Similar Posts