The first Test point WA, help!!!
Attached question address:1367A
#include<bits/stdc++.h>
using namespace std;
int n,flag;
string s;
int main(){
cin>>n;
while(n--){
cin>>s;
for(int i=0;i<s.size();i++){
if(s[i]!=s[i-1]&&flag>0){
cout<<s[i];
flag=0;
}
else{
flag++;
}
}
cout<<endl;
}
return 0;
}
Your code is leaving out the first letter of the answer. You should fix it by putting cout << s[0] before the for loop.