当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2887:Big String

题目描述

You are given a string and supposed to do some string manipulations.

输入解释

The first line of the input contains the initial string. You can assume that it is non-empty and its length does not exceed 1,000,000.

The second line contains the number of manipulation commands N (0 < N 2,000). The following N lines describe a command each. The commands are in one of the two formats below:

  1. I ch p: Insert a character ch before the p-th character of the current string. If p is larger than the length of the string, the character is appended to the end of the string.
  2. Q p: Query the p-th character of the current string. The input ensures that the p-th character exists.

All characters in the input are digits or lowercase letters of the English alphabet.

输出解释

For each Q command output one line containing only the single character queried.

输入样例
ab
7
Q 1
I c 2
I d 4
I e 2
Q 5
I f 1
Q 3
输出样例
a
d
e

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-2887

最后修改于 2020-10-29T06:46:45+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 131072