eolymp
bolt
Try our new interface for solving problems
Problems

Wild Card

Wild Card

String \textbf{file }contains the file name. You must rename it to match the string \textbf{pattern} that can contain the joker symbol ‘?’ (any one symbol) using the minimal number of moves. A move is defined as adding a character, deleting a character, or modifying a character from the filename. \InputFile Each line contains two strings \textbf{file} and \textbf{pattern} of length no more than \textbf{50}. Each character in \textbf{file} is a lowercase letter ('a' - 'z'). Each character in \textbf{pattern} is a lowercase letter ('a' - 'z') or '?'. \OutputFile For each pair of strings print in a separate line the minimal number of moves that transform \textbf{file} to \textbf{pattern}.
Time limit 1 second
Memory limit 64 MiB
Input example #1
abcd bcd
aaaabbb aa????b
asdjkhajksdhajksdh asdjkhasdjk?
niceone ieo?e
Output example #1
1
0
6
2