DEV Community

Discussion on: Daily Challenge #244 - Search for Letters

Collapse
 
iamhrithikraj profile image
Hrithik Raj • Edited

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;
    }

}
Enter fullscreen mode Exit fullscreen mode