Created
October 1, 2023 15:46
This is my code of Problem A of AtCoder Beginner Contest 322.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 入力 | |
N = int(input()) | |
S = input() | |
# 「ABC」と連続している部分を探す | |
for i in range(N - 2): | |
if S[i] == "A" and S[i + 1] == "B" and S[i + 2] == "C": | |
print(i + 1) | |
exit() | |
# 「ABC」と連続している部分がなかった場合 | |
print(-1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment