Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<string>
- #include<stdio.h>
- #include <math.h>
- using namespace std;
- template <typename X>
- inline X abs(const X &a) { return a < 0 ? -a : a; }
- int count_words[1000];
- int main()
- {
- string a[1000];
- string s, t = "";
- getline(cin, s);
- char g; cin >> g;
- g = tolower(g);
- int cnt = 0;
- for (int i = 0; i < s.length(); ++i) {
- char c = s[i];
- if (isspace(c) || ispunct(c))
- {
- a[cnt++] = t;
- t = "";
- }
- else
- t += c;
- }
- for (int i = 0; i < cnt; ++i)
- if (tolower(a[i][0]) == g )
- cout << a[i] << '\n';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement