Advertisement
rotti321

cuv cu vocale & cuv palindrom C

Feb 23rd, 2022
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4. int main() {
  5. char *p,s[256],voc[]="AEIOUaeiou",cuv[256];
  6. int ok,k=0,lung;
  7. gets(s);
  8. // printf("%s",s);
  9. p=strtok(s," .");
  10. while(p!=NULL){
  11. for(int i=0;voc[i]!=NULL;i++){
  12. if(strchr(p,voc[i])!=NULL){
  13. k++;
  14. break;
  15. }
  16. }
  17. strcpy(cuv,p);
  18. ok=1;
  19. lung=strlen(cuv);
  20. for(int i=0;i<lung/2;i++){
  21. if(cuv[i]!=cuv[lung-i-1]){
  22. ok=0;
  23. break;
  24. }
  25. }
  26. if(ok==1) printf("%s ",cuv);
  27. p=strtok(NULL," .");
  28. }
  29. printf("\n%d",k);
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement