欧美1区2区3区激情无套,两个女人互添下身视频在线观看,久久av无码精品人妻系列,久久精品噜噜噜成人,末发育娇小性色xxxx

題解 | 字符串加密

字符串加密

http://www.fangfengwang8.cn/practice/e4af1fe682b54459b2a211df91a91cf3

#include <iostream>
#include <string>
#include <cctype>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    string key,words;
    while(cin >> key >> words){
        vector<char> v;
        //去重
        for(int i = 0; i < key.length();i++){
            key[i] = toupper(key[i]);
            auto it = find(v.begin(),v.end(),key[i]);
            if(it == v.end()){
                v.push_back(key[i]);
            }
        }
        //補全
        for(char c = 'A'; c <= 'Z'; c++){
            auto it = find(v.begin(),v.end(),c);
            if(it == v.end()){
                v.push_back(c);
            }
        }
        //加密
        string output = "";
        for(int i = 0; i < words.length(); i++){
            if(islower(words[i])){
                output += v[words[i] - 'a'] + 32;
            }else{
                output += v[words[i] - 'A'];
            }
        }
        cout << output << endl;
    }
}
// 64 位輸出請用 printf("%lld")

cctype這個庫中的挺多函數還挺好用的,比如說isupper檢查是否是大寫字符;tolower將字符轉成小寫形式;同樣的道理islower檢查是否是小寫字符,toupper將小寫字符轉成大寫字符;

全部評論

相關推薦

點贊 評論 收藏
分享
深夜書店vv:騰訊是這樣的,去年很多走廊都加桌子當工區(qū)
點贊 評論 收藏
分享
評論
1
收藏
分享

創(chuàng)作者周榜

更多
??途W
??推髽I(yè)服務