Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool isCorrect(char c) {
- return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('а' <= c && c <= 'я') || ('А' <= c && c <= 'Я');
- }
- string currentWord = "";
- char c;
- vector<string> words;
- while (!in.eof()) {
- in >> c;
- if (!isCorrect(c)) {
- if (currentWord.size() > 0) {
- words.push_back(currentWord);
- }
- currentWord = "";
- } else {
- currentWord += c;
- }
- }
- if (currentWord.size() > 0) {
- words.push_back(currentWord);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement