#P125. [KSC003C] 赶集

[KSC003C] 赶集

Source

This problem is adapted from Long Long OJ. All rights reserved.

Problem Description

Given a string ss consisting only of the characters G,J,g,j\tt{G,J,g,j}, count the number of occurrences of the substring gj\tt{gj} (case-sensitive).

Input Format

A single line containing the string ss (1s101\le|s|\le 10).

Output Format

Let the answer be ansans. If ans0ans\neq 0, then f(ans)f(ans) is defined as the result of concatenating 11 and ans1ans-1 into a single number (if any digit in this number is 00, that digit is ignored). Otherwise (when ans=0ans=0), f(ans)=0f(ans)=0. Output f(ans)f(ans). For example:

  • If ans=1ans=1, f(ans)=1f(ans)=1 (the 00 in 1010 is ignored).
  • If ans=5ans=5, f(ans)=14f(ans)=14.
  • If ans=11ans=11, f(ans)=11f(ans)=11 (the 00 in 110110 is ignored).

Samples

Gj
0
ggj
1