The problem is from codeforces: http://codeforces.com/contest/265/problem/A
This is a pure simulation problem, no difficulty at all. If the current instruction matches the colour on the current stone, move one position right otherwise stay put.
#!/usr/bin/env python s = raw_input() t = raw_input() j = 0 for i in t: if i == s[j]: j += 1 print j + 1
–EOF (The Ultimate Computing & Technology Blog) —
Last Post: Codeforces: 263D Cycle of Graph
Next Post: Codeforces: B. Roadside Trees (Simplified Edition)