UVA 10008 - What's Cryptanalysis?

Problem PDF

Solution:

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define ll long long
#define sc scanf
#define pf printf
#define pi 2*acos(0.0)
using namespace std;

struct Map
{
    char c;
    int count;
};

bool compare(Map a, Map b)
{
    if(a.count > b.count )
    {
        return true;
    }
    else if(a.count == b.count)
    {
        return a.c < b.c;
    }
    else
    {
        return false;
    }
//    return a.c < b.c ;
}
int main()
{
    char c;
    string s;
    Map str[26];
    for(int i=0; i<26; i++)
    {
        str[i].c = i + 'A';
        str[i].count = 0;
    }
    int cases, len;
    cin>>cases;
    cin.ignore();
    while(cases--)
    {
        getline(cin, s);
        len = s.length();
        for(int i=0; i
https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/10008/10008.cpp