View Code of Problem 3924

#include<iostream>


using namespace std;

int main(){
	string str;
	cin>>str;
	for(int i=0;i<str.length();++i){
		while(s[i]==s[i+1]){
			i++;
		}
		cout<<s[i];
	}
	
	return 0;
}
/*
Main.cc: In function 'int main()':
Main.cc:9:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  for(int i=0;i<str.length();++i){
              ~^~~~~~~~~~~~~
Main.cc:10:9: error: 's' was not declared in this scope
   while(s[i]==s[i+1]){
         ^
Main.cc:13:9: error: 's' was not declared in this scope
   cout<<s[i];
         ^
*/

Double click to view unformatted code.


Back to problem 3924