Last active
February 15, 2020 16:27
-
-
Save invatainfo/040f610ff410e8d3217811949ff40f56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string.h> | |
using namespace std; | |
int main() { | |
int n, no_words = 0, i, exista_mari = 0, exista_mici = 0; | |
char text[101], words[100][100], *p; | |
cin >> n; | |
cin.get(); | |
cin.getline(text, 100); //citim tot textul | |
p = strtok(text, " "); | |
while (p != NULL) { | |
strcpy(words[no_words++], p); | |
if (strlen(p) >= n) { | |
exista_mari = 1; | |
} else { | |
exista_mici = 1; | |
} | |
p = strtok(NULL, " "); | |
} | |
if (exista_mari == 0 || exista_mici == 0) { | |
cout << "nu exista" << endl; | |
return 0; | |
} | |
for (i = 0; i < no_words; i++) { | |
if (strlen(words[i]) >= n) { | |
cout << words[i] << endl; | |
} | |
} | |
for (i = 0; i < no_words; i++) { | |
if (strlen(words[i]) < n) { | |
cout << words[i] << endl; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment