22318_Keylogger

2022-5-16 18:21| 发布者: Hocassian| 查看: 22| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506317272900-Problem List-采集的数据-后羿采集器.html

Pro.ID

22318

Title

Keylogger

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22318

AC

12

Submit

56

Ratio

21.43%

时间&空间限制

  • Time Limit: 8000/2000 MS (Java/Others)     Memory Limit: 131072/65536 K (Java/Others)
  • 描述

    As a malicious hacker you are trying to steal your mother's password, and therefore you have installed a keylogger on her PC (or Mac, so you like). You have a log from your mother typing the password, but unfortunately the password is not directly visible because she used the left and right arrows to change the position of the cursor, and the backspace to delete some characters. Write a program that can decode the password from the given keylog.

    输入

    The first line of the input contains a single number: the number of test cases to follow. Each test case has the following format:

    One line with a string L, satisfying 1 ≤ Length(L) ≤ 1,000,000, consisting of:

    • '-' representing backspace: the character directly before the cursor position is deleted, if there is any.

    • '<'  (and '>' ) representing the left (right) arrow: the cursor is moved 1 character to the left (right), if possible.

    • alphanumeric characters, which are part of the password, unless deleted later. We assume 'insert mode': if the cursor is not at the end of the line, and you type an alphanumeric character, then all characters after the cursor move one position to the right.

    Every decoded password will be of length > 0.

    输出

    Description

    As a malicious hacker you are trying to steal your mother's password, and therefore you have installed a keylogger on her PC (or Mac, so you like). You have a log from your mother typing the password, but unfortunately the password is not directly visible because she used the left and right arrows to change the position of the cursor, and the backspace to delete some characters. Write a program that can decode the password from the given keylog.

    Input

    The first line of the input contains a single number: the number of test cases to follow. Each test case has the following format:

    One line with a string L, satisfying 1 ≤ Length(L) ≤ 1,000,000, consisting of:

    • '-' representing backspace: the character directly before the cursor position is deleted, if there is any.

    • '<'  (and '>' ) representing the left (right) arrow: the cursor is moved 1 character to the left (right), if possible.

    • alphanumeric characters, which are part of the password, unless deleted later. We assume 'insert mode': if the cursor is not at the end of the line, and you type an alphanumeric character, then all characters after the cursor move one position to the right.

    Every decoded password will be of length > 0.

    Output

    For every test case in the input, the output should contain a single string, on a single line: the decoded password.

    Sample Input

    2
    <<BP<A>>Cd-
    ThIsIsS3Cr3t

    Sample Output

    BAPC
    ThIsIsS3Cr3t

    Source

    样例输入

    2
    <<BP<A>>Cd-
    ThIsIsS3Cr3t

    样例输出

    BAPC
    ThIsIsS3Cr3t

    提示

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部