import Foundation
let N = Int(readLine()!)!
var s = readLine()!.characters.map{$0}
let t = readLine()!.characters.map{$0}
for c in t {
  if s.last! == c {
    s.removeLast()
  } else {
    break
  }
}
print(String(s+t))