結果
| 問題 | No.2629 A replace B replace C | 
| コンテスト | |
| ユーザー |  timi | 
| 提出日時 | 2024-02-16 21:49:10 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 56 ms / 2,000 ms | 
| コード長 | 452 bytes | 
| コンパイル時間 | 315 ms | 
| コンパイル使用メモリ | 82,588 KB | 
| 実行使用メモリ | 76,020 KB | 
| 最終ジャッジ日時 | 2024-09-28 20:03:20 | 
| 合計ジャッジ時間 | 4,913 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 5 | 
| other | AC * 61 | 
ソースコード
# T=int(input())
# for _ in range(T):
#   x1,y1,x2,y2,X1,Y1,X2,Y2=map(int,input().split())
N=int(input())
S=input()
T=input()
if S==T:
  print('Yes')
  exit()
x,y,z=0,0,0
for i in range(N):
  s,t=S[i],T[i]
  if s!=t:
    if s=='A' and t=='B':
      x+=1
    elif s=='A' and t=='C':
      y+=1
    elif s=='B' and t=='C':
      z+=1
    else:
      print('No')
      exit()
if x!=z:
  print('No')
  exit()
if z>0:
  print('Yes')
else:
  print('No')
  
            
            
            
        