Competitive Programming Problem

(I am not good at english.)
I have a problem, but I don't know how to solve this problem. Please help me.

or anyone know the source of this problem, please tell me

Given two strings word1 and word2, find the minimum number of operations required to convert word1 to word2.

there are two operations permitted on a word:
1. move a character to front
2. move a character to back

Input:
word1 = "ABCDEF"
word2 = "CBAEFD"

Output:
3

Explanation:
1. move 'D' to back 
   word1 = "ABCEFD"
2. move 'B' to front 
   word1 = "BACEFD"
3. move 'C' to front 
   word1 = "CBAEFD"
Comments (1)