UVA-10115 Automatic Editing

原题链接:

https://vjudge.net/problem/UVA-10115#author=Luke

AC代码:

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    while (cin >> n && n != 0)
    {
        string s1[20];
        string s2[20];
        getchar();
        for (int i = 0; i < n; i++)
        {
            getline(cin, s1[i]);
            getline(cin, s2[i]);
        }
        string str;
        getline(cin, str);
        for (int i = 0; i < n; i++)
        {
            int index = 0;
            index = str.find(s1[i]);
            while (index != str.npos)
            {
                str = str.replace(index, s1[i].length(), s2[i]);
                index = str.find(s1[i]);
            }
        }
        cout << str << endl;
    }
    return 0;
}

### Minimal BASH-like Line Editing Support in Shell Environments Minimal BASH-like line editing provides users with a set of keyboard shortcuts and commands that facilitate easier command-line interaction within shell environments. This feature allows for more efficient navigation, editing, and recall of previous commands without the need to fully rely on external tools or complex configurations. In many Unix-like operating systems, including Linux distributions and macOS, shells such as Bash (Bourne Again SHell), Zsh (Z-shell), and others offer built-in support for this functionality through readline libraries[^1]. These libraries enable features like: - **Command History Navigation**: Using arrow keys (`↑` `↓`) to scroll through previously entered commands. - **Text Movement Shortcuts**: Utilizing Ctrl+A (move cursor to beginning of line) and Ctrl+E (move cursor to end of line). - **Word-based Editing**: Employing Alt+B (move backward one word) and Alt+F (move forward one word). For demonstration purposes, consider an example where a user wants to edit a long command string interactively using these minimal BASH-like keybindings inside any compatible terminal session: ```bash $ python manage.py runserver --settings=myproject.settings.local ``` If the user needs to modify part of this command quickly, instead of retyping everything from scratch, they can use combinations mentioned above to navigate around efficiently before pressing Enter again to execute it anew after modifications are done. Additionally, some advanced shells provide even richer sets of functionalities beyond basic ones provided by default settings; however, those enhancements usually require additional configuration steps not covered under 'minimal' scope here discussed[^2].
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值