Cod sursa(job #3148840)
Utilizator | Data | 4 septembrie 2023 16:49:55 | |
---|---|---|---|
Problema | Litere | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("litere.in");
ofstream fout("litere.out");
int f[26];
int main()
{
int n,x,rasp=0;
char c;
fin>>n;
for(int i=0;i<n;i++)
{
fin>>c;
x=c-97;
for(int j=x+1;j<26;j++)
{
rasp+=f[j];
}
f[x]++;
}
fout<<rasp;
}