結果 : algorithm for pattern matching