Advertisement
sellmmaahh

OR-2007-BrDuplihSlova

Aug 11th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1.  
  2. #include<stdio.h>
  3. #include<math.h>
  4.  
  5. int slova2puta (char *s) {
  6.     int slova[30]={0};
  7.     while (*s!='\0') {
  8.             if (*s>='a' && *s<='z') slova[*s-'a']++;
  9.             if (*s>='A' && *s<='Z') slova[*s-'A']++;
  10.             s++;
  11.     }
  12.     int br_dva_slova=0,j;
  13.     for (j=0; j<30; j++) {
  14.             if (slova[j]==2) br_dva_slova++;
  15.     }
  16.     return br_dva_slova;
  17. }
  18.  
  19. int main () {
  20.     char s[]="123seslmma";
  21.     printf("%d",slova2puta(s));
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement