loading...

re: Daily Challenge #244 - Search for Letters VIEW POST

FULL DISCUSSION
 

C++17


#include<bits/stdc++.h>
using namespace std;
int main() {
    string str;
    vector<int>vec(26, 0);
    getline(cin, str);
    transform(str.begin(), str.end(), str.begin(), ::tolower);
    for (auto i = str.begin(); i != str.end(); ++i) {
        if (isalpha(*i)) {
            vec[*i - 'a'] = 1;
        }
    }
    for (auto i = vec.begin(); i != vec.end(); ++i) {
        cout << *i;
    }

}
code of conduct - report abuse