Submission #853811

# Submission time Handle Problem Language Result Execution time Memory
853811 2023-09-25T09:25:12 Z AndrijaM Laugh Analysis (IOI16_laugh) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

const long long mod=1e9+7;
const long long maxn=2e5+10;
const long long logn=23;

int n,q;

int main()
{
    string s;
    cin>>s;
    n=s.size();
    int ans=0;
    for(int i=0;i<n;i++)
    {
        if(s[i]=='a' || s[i]=='h')
        {
            int j=i-1;
            char k[2];
            k[0]='a';
            k[1]='h';
            if(s[i]=='h')
            {
                swap(k[0],k[1]);
            }
            while(j+1<n && s[j+1]==k[0])
            {
                swap(k[0],k[1]);
                j++;
            }
            ans=max(ans, j-i+1);
            i=j;
        }
    }
    cout<<ans<<endl;
    return 0;
}
/*
7 1
1 1 1 1 1 1 1
1 3
1 2
3 7
2 4
2 5
2 6
2 2*/

Compilation message

/usr/bin/ld: /tmp/ccz6KIae.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccvq7age.o:laugh.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccz6KIae.o: in function `main':
grader.cpp:(.text.startup+0x65): undefined reference to `longest_laugh(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
collect2: error: ld returned 1 exit status