1035.Password

題目描述

To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L in lowercase), or 0 (zero) from O (o in uppercase). One solution is to replace 1 (one) by @, 0 (zero) by %, l by L, and O by o. Now it is your job to write a program to check the accounts generated by the judge, and to help the juge modify the confusing passwords.

Input Specification:

Each input file contains one test case. Each case contains a positive integer N (≤1000), followed by N lines of accounts. Each account consists of a user name and a password, both are strings of no more than 10 characters with no space.

Output Specification:

For each test case, first print the number M of accounts that have been modified, then print in the following M lines the modified accounts info, that is, the user names and the corresponding modified passwords. The accounts must be printed in the same order as they are read in. If no account is modified, print in one line There are N accounts and no account is modified where N is the total number of accounts. However, if N is one, you must print There is 1 account and no account is modified instead.

Sample Input 1:

3
Team000002 Rlsp0dfa
Team000003 perfectpwd
Team000001 R1spOdfa

Sample Output 1:

2
Team000002 RLsp%dfa
Team000001 R@spodfa

Sample Input 2:

1
team110 abcdefg332

Sample Output 2:

There is 1 account and no account is modified

Sample Input 3:

2
team110 abcdefg222
team220 abcdefg333

Sample Output 3:

There are 2 accounts and no account is modified

代碼

#include <iostream>
#include <vector>
#include <string>
using namespace std;
struct node {
    string id, pwd;
};
int main() {
    int n;
    string id, pwd;
    scanf("%d", &n);
    vector<node> stu;
    for (int i = 0; i < n; i++) {
        cin >> id >> pwd;
        int flag = 0;
        for (int i = 0; i < pwd.length(); i++) {
            switch (pwd[i]) {
            case '1':pwd[i] = '@'; flag = 1; break;
            case '0':pwd[i] = '%'; flag = 1; break;
            case 'l':pwd[i] = 'L'; flag = 1; break;
            case 'O':pwd[i] = 'o'; flag = 1; break;
            default: break;
            }
        }
        if (flag) stu.push_back(node{ id,pwd });
    }
    int cnt = stu.size();
    if (cnt != 0) {
        printf("%d\n", cnt);
        for (int i = 0; i < cnt; i++) cout << stu[i].id << " " << stu[i].pwd << endl;
    }
    else if (n == 1) printf("There is 1 account and no account is modified");
    else printf("There are %d accounts and no account is modified", n);
    return 0;
}
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末终息,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子逆皮,更是在濱河造成了極大的恐慌苞也,老刑警劉巖,帶你破解...
    沈念sama閱讀 222,729評(píng)論 6 517
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件棒厘,死亡現(xiàn)場(chǎng)離奇詭異纵穿,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī)奢人,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,226評(píng)論 3 399
  • 文/潘曉璐 我一進(jìn)店門(mén)谓媒,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人何乎,你說(shuō)我怎么就攤上這事句惯。” “怎么了支救?”我有些...
    開(kāi)封第一講書(shū)人閱讀 169,461評(píng)論 0 362
  • 文/不壞的土叔 我叫張陵抢野,是天一觀的道長(zhǎng)。 經(jīng)常有香客問(wèn)我各墨,道長(zhǎng)指孤,這世上最難降的妖魔是什么? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 60,135評(píng)論 1 300
  • 正文 為了忘掉前任贬堵,我火速辦了婚禮恃轩,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘黎做。我一直安慰自己叉跛,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 69,130評(píng)論 6 398
  • 文/花漫 我一把揭開(kāi)白布蒸殿。 她就那樣靜靜地躺著筷厘,像睡著了一般。 火紅的嫁衣襯著肌膚如雪宏所。 梳的紋絲不亂的頭發(fā)上酥艳,一...
    開(kāi)封第一講書(shū)人閱讀 52,736評(píng)論 1 312
  • 那天,我揣著相機(jī)與錄音楣铁,去河邊找鬼玖雁。 笑死,一個(gè)胖子當(dāng)著我的面吹牛盖腕,可吹牛的內(nèi)容都是我干的赫冬。 我是一名探鬼主播浓镜,決...
    沈念sama閱讀 41,179評(píng)論 3 422
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼劲厌!你這毒婦竟也來(lái)了膛薛?” 一聲冷哼從身側(cè)響起,我...
    開(kāi)封第一講書(shū)人閱讀 40,124評(píng)論 0 277
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤补鼻,失蹤者是張志新(化名)和其女友劉穎哄啄,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體风范,經(jīng)...
    沈念sama閱讀 46,657評(píng)論 1 320
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡咨跌,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,723評(píng)論 3 342
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了硼婿。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片锌半。...
    茶點(diǎn)故事閱讀 40,872評(píng)論 1 353
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖寇漫,靈堂內(nèi)的尸體忽然破棺而出刊殉,到底是詐尸還是另有隱情,我是刑警寧澤州胳,帶...
    沈念sama閱讀 36,533評(píng)論 5 351
  • 正文 年R本政府宣布记焊,位于F島的核電站,受9級(jí)特大地震影響栓撞,放射性物質(zhì)發(fā)生泄漏遍膜。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 42,213評(píng)論 3 336
  • 文/蒙蒙 一腐缤、第九天 我趴在偏房一處隱蔽的房頂上張望捌归。 院中可真熱鬧,春花似錦岭粤、人聲如沸。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 32,700評(píng)論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至猎物,卻和暖如春虎囚,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背蔫磨。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,819評(píng)論 1 274
  • 我被黑心中介騙來(lái)泰國(guó)打工淘讥, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人堤如。 一個(gè)月前我還...
    沈念sama閱讀 49,304評(píng)論 3 379
  • 正文 我出身青樓蒲列,卻偏偏與公主長(zhǎng)得像窒朋,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子蝗岖,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,876評(píng)論 2 361

推薦閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,350評(píng)論 0 10
  • **2014真題Directions:Read the following text. Choose the be...
    又是夜半驚坐起閱讀 9,586評(píng)論 0 23
  • 2019 1.18 星期五 天氣晴 今天孩子放假了侥猩!漫長(zhǎng)的假期從周一開(kāi)始了! 今晚上開(kāi)家長(zhǎng)...
    往事隨風(fēng)_452e閱讀 253評(píng)論 1 1
  • 以撒年老抵赢,眼睛昏花欺劳,看不見(jiàn)東西了;(創(chuàng)世記 27:1 新譯本) 以撒是敬畏神的人铅鲤,他身上有很多的優(yōu)點(diǎn):順?lè)?..
    wakeup王閱讀 1,233評(píng)論 0 0
  • 10.21先試試表達(dá)攻擊性 本周主要圍繞著攻擊性去講解的划提,而攻擊性就相當(dāng)于負(fù)能量一樣或者一些情緒一樣可能會(huì)在不自...
    徐猛_Merlin閱讀 257評(píng)論 0 0