Advertisement
J3st3rs_j0k3

qeefytuygi

Mar 3rd, 2021
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.20 KB | None | 0 0
  1. void mostrecent(char * text, char * word){
  2.     char words[2000][30];
  3.     int r[2000];
  4.     int i,j, m, q, w = 1;
  5.     for (i = 0; i < 2000; i++){
  6.         for (j=0; j < 30; j++){
  7.             words[w][i]= *text;
  8.         }
  9.     }
  10.     for(;*text; text++){
  11.         if(isalpha(text)){
  12.             for(i = 0; isalpha(text); text++; i++){
  13.        
  14.              words[w][i] = *text;  
  15.             }
  16.             w++;
  17.         }
  18.     }
  19.     for (i = 0; i < 2000; i++){
  20.         for (j=0; j < 30; j++){
  21.             words[i][j] = toupper(words[i][j]);
  22.         }
  23.     }    
  24.     for (i=0; i < w; i++){
  25.         for(j=(i+1); j<w;j++){
  26.             if(!(strcmp(words[i],words[j]))){
  27.                 r[i]++;
  28.             }
  29.         }
  30.     }    
  31.     for (i=0; i < w; i++){
  32.         if(!(strcmp(words[0],words[i]))){
  33.             r[0]++;
  34.         }
  35.     }
  36.     m = r[1];
  37.     q = 1;
  38.     for(i=2; i <w; i++){
  39.         if(r[i]>m){
  40.             m = r[i];
  41.         }
  42.     }
  43.     strcpy(word; words[q]);
  44. }
  45.  
  46. char* rmv_word(char * rests, const char* restw ){
  47.     int len = strlen(w);
  48.     for (char * ptr = strstr(s, w); ptr; ptr = strstr(ptr, w)){
  49.         memmove(ptr, ptr + len, strlen(ptr+ len)+1);
  50.     }
  51.     return s;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement