Algorithms, Blockchain and Cloud

Codeforces: A. Colorful Stones (Simplified Edition)


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) —

138 words
Last Post: Codeforces: 263D Cycle of Graph
Next Post: Codeforces: B. Roadside Trees (Simplified Edition)

The Permanent URL is: Codeforces: A. Colorful Stones (Simplified Edition) (AMP Version)

Exit mobile version