Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstring>
- using namespace std;
- void citire(char* str, size_t size)
- {
- ifstream infile("date.in");
- infile.get(str, size);
- }
- int CountValidWords(char* str)
- {
- int wordCount = 0;
- for(int i = 0; i < strlen(str); i++)
- {
- int start = 0, end = 0;
- if(str[i] != ' ' && str[i] != '_')
- {
- start = i;
- while(str[i] != ' ' && str[i] != '_' && i < strlen(str))
- {
- end = i++;
- }
- if(end - start + 1 >= 7)
- {
- char* aux;
- strncpy(aux, str + start, end - start + 1);
- if(strchr(aux, 'u') != NULL)
- {
- wordCount++;
- }
- }
- }
- }
- return wordCount;
- }
- int main()
- {
- char str[500];
- citire(str, 500);
- cout << CountValidWords(str);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement