Alpha
SRM 768 · 2019-10-09 · by Errichto
Problem Statement
Limak is a little bear who wants to learn the English alphabet. He tries to say the whole alphabet from 'a' to 'z'. Your job is to stop him when he makes a mistake. Can you check how many first letters he said correctly?
You are given a
Constraints
- The number of characters in s will be between 1 and 26, inclusive.
- Each character in s will be a lowercase English character ('a' - 'z').
"abctyf" Returns: 3
The first three characters match: a, b, c.
"abcdefghijklmnopqrstuvwxyz" Returns: 26
All 26 characters match the English alphabet exactly.
"zyx" Returns: 0
"abcdegfhijk" Returns: 5
Characters 'f' and 'g' are swapped, so we only accept first five characters (abcde).
"ba" Returns: 0
Submissions are judged against all 70 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class Alpha with a public method int maxPref(string s) · 70 test cases · 2 s / 256 MB per case