View Code of Problem 3924

#include<stdio.h>
#include <string.h>
const int MAXN = 1e9 + 10;
 
int main(){
	char s[MAXN]; 
	scanf("%s", s);
	int len = strlen(s);
	 
	int yidong = 0;
	for(int i=0; i<len; i+=yidong){
		int cnt = 0;
		for(int j=i+1; j<len; j++){
			if(s[i] == s[j]){
				s[j] = '*';
				cnt++;
			}	
		} 
		yidong = cnt+1;
	}
	
	for(int i=0; i<len; i++){
		if(s[i] != '*'){
			printf("%c", s[i]);
		}
	}
	printf("\n");

	return 0;
}

Double click to view unformatted code.


Back to problem 3924