Skip to content

Instantly share code, notes, and snippets.

@Shinoryo
Created October 1, 2023 15:46
This is my code of Problem A of AtCoder Beginner Contest 322.
# 入力
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