結果
| 問題 | 
                            No.2018 X-Y-X
                             | 
                    
| コンテスト | |
| ユーザー | 
                             gew1fw
                         | 
                    
| 提出日時 | 2025-06-12 17:06:10 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 340 bytes | 
| コンパイル時間 | 146 ms | 
| コンパイル使用メモリ | 82,220 KB | 
| 実行使用メモリ | 95,020 KB | 
| 最終ジャッジ日時 | 2025-06-12 17:06:14 | 
| 合計ジャッジ時間 | 2,958 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 8 WA * 23 | 
ソースコード
n = int(input())
s = list(input().strip())
t = list(input().strip())
operations = 0
for i in range(n - 2):
    if s[i] != s[i + 2]:
        continue
    if s[i + 1] == t[i + 1]:
        continue
    # Perform the flip
    s[i + 1] = 'A' if s[i + 1] == 'B' else 'B'
    operations += 1
if s == t:
    print(operations)
else:
    print(-1)
            
            
            
        
            
gew1fw