This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <cstdlib> | |
| #include <cstring> | |
| #include <cstdio> | |
| #include <wchar.h> | |
| #include <string> | |
| #include <iconv.h> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| boost_split, vector<string> v; | |
| boost::algorithm::split(v, str, bind2nd(equal_to<char>(), ' ') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vector<string> split(const string &str){ | |
| istringstream iss(str); vector<string> res; | |
| copy(istream_iterator<string>(iss), istream_iterator<string>(), back_inserter(res)); | |
| return res; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vector<string> split(const string &str, char delim){ | |
| istringstream iss(str); string tmp; vector<string> res; | |
| while(getline(iss, tmp, delim)) res.push_back(tmp); | |
| return res; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vector<string> split(const string &str, const string &delim){ | |
| vector<string> res; | |
| size_t current = 0, found, delimlen = delim.size(); | |
| while((found = str.find(delim, current)) != string::npos){ | |
| res.push_back(string(str, current, found - current)); | |
| current = found + delimlen; | |
| } | |
| res.push_back(string(str, current, str.size() - current)); | |
| return res; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vector<string> split(const string &str, char delim){ | |
| vector<string> res; | |
| size_t current = 0, found; | |
| while((found = str.find_first_of(delim, current)) != string::npos){ | |
| res.push_back(string(str, current, found - current)); | |
| current = found + 1; | |
| } | |
| res.push_back(string(str, current, str.size() - current)); | |
| return res; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| string decode(string cipherText, int shift) | |
| { | |
| size_t len = cipherText.size(); | |
| string res(cipherText); | |
| for(size_t i = 0; i < len; i++){ | |
| int c = res[i] - 'A'; | |
| if(c - shift < 0) | |
| c = 26 + (c - shift); | |
| else | |
| c = c - shift; |
NewerOlder