Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void mostrecent(char * text, char * word){
- char words[2000][30];
- int r[2000];
- int i,j, m, q, w = 1;
- for (i = 0; i < 2000; i++){
- for (j=0; j < 30; j++){
- words[w][i]= *text;
- }
- }
- for(;*text; text++){
- if(isalpha(text)){
- for(i = 0; isalpha(text); text++; i++){
- words[w][i] = *text;
- }
- w++;
- }
- }
- for (i = 0; i < 2000; i++){
- for (j=0; j < 30; j++){
- words[i][j] = toupper(words[i][j]);
- }
- }
- for (i=0; i < w; i++){
- for(j=(i+1); j<w;j++){
- if(!(strcmp(words[i],words[j]))){
- r[i]++;
- }
- }
- }
- for (i=0; i < w; i++){
- if(!(strcmp(words[0],words[i]))){
- r[0]++;
- }
- }
- m = r[1];
- q = 1;
- for(i=2; i <w; i++){
- if(r[i]>m){
- m = r[i];
- }
- }
- strcpy(word; words[q]);
- }
- char* rmv_word(char * rests, const char* restw ){
- int len = strlen(w);
- for (char * ptr = strstr(s, w); ptr; ptr = strstr(ptr, w)){
- memmove(ptr, ptr + len, strlen(ptr+ len)+1);
- }
- return s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement