Submission #1086237

#TimeUsernameProblemLanguageResultExecution timeMemory
1086237Noname_1900Laugh Analysis (IOI16_laugh)C++17
100 / 100
2 ms732 KiB
#include "laugh.h"
#include<iostream>
using namespace std;
int longest_laugh(std::string s)
{
    char anc = ' ';
    int longueurMax = 0;
    int longeur = 0;
    for(char a : s)
    {
       // cout << longeur << endl;
        if(a == 'a')    
        {
           // cout << "bbb";
          //  cout << anc << endl;
            if(anc == 'h')
            {
                longeur++;
            }
            else
            {
                longeur = 1;
            }
        }
        else if(a == 'h')
        {
            if(anc == 'a')
            {
                longeur++;
            }
            else
                longeur = 1;
        }
        else
            longeur = 0;
        longueurMax = max(longueurMax, longeur);
        anc = a;
    }
    return longueurMax;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...