Submission #1104296

#TimeUsernameProblemLanguageResultExecution timeMemory
1104296overwatch9Laugh Analysis (IOI16_laugh)C++17
100 / 100
3 ms848 KiB
#include <bits/stdc++.h> using namespace std; int longest_laugh(string s) { int ans = 0; int x = 0; for (int i = 0; i < (int)s.size(); i++) { if (s[i] == 'h') { if ((i-1 < 0) || (i-1 >= 0 && s[i-1] == 'a')) { x++; } else x = 1; } else if (s[i] == 'a') { if ((i-1 < 0) || (i-1 >= 0 && s[i-1] == 'h')) { x++; } else x = 1; } else { x = 0; } ans = max(ans, x); } return ans; } // int main() { // string s; // cin >> s; // cout << longest_laugh(s) << '\n'; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...