#include <stdio.h>
#include <string.h>
void remove_last_occurrences(char str[], char ch) {
int len = strlen(str), lastIndexOf_c = -1;
for (int i = 0; i < len; i++){
if (str[i] == ch) {
lastIndexOf_c = i;
}
}
if (lastIndexOf_c != -1) {
memmove(str + lastIndexOf_c, str + lastIndexOf_c + 1, len - lastIndexOf_c + 1);
}
}
int main() {
char str[64] = "c python c++ c# java";
remove_last_occurrences(str, 'c');
puts(str);
return 0;
}
/*
run:
c python c++ # java
*/