Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int MaxDuzina (char *s) {
- int max_duz=0;
- char *p=s;
- while (*s!='\0') {
- if ((tolower(*s)>='a' && tolower(*s)<='z' && s==p) || (tolower(*s)>='a' && tolower(*s)<='z' && *(s-1)==' '))
- { char *poc=s;
- while (tolower(*s)>='a' && tolower(*s)<='z')
- s++;
- char *kraj=s;
- if ((kraj-poc)>max_duz) max_duz=kraj-poc;
- }
- else s++;
- }
- return max_duz;
- }
- int main () {
- char s[]="Ovo je recenica. ";
- printf("Najduza rijec ima %d znakova.",MaxDuzina(s));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement