WA求调!!!

P1320 压缩技术(续集版)

liuyuxiaozaizai @ 2024-09-27 22:36:45

#include<iostream>
#include<cstdio>
#include<string>
using namespace std; 
string s,jg;
int d=0,cnt=0,kg=0;
int main(){
    cin>>s;
    int len=s.length();
    for (int j=0;j<len;j++){
        if (j!=0){cin>>s;}else{jg+=(char)(len);}
        for (int i=0;i<len;i++){
            if (((int)(s[i])-48)!=d){
                jg+=(char)(cnt);
                cnt=1;
                if (d==0){
                    d=1;
                }else{
                    d=0;
                }
            }else{
                cnt++;
            }
        } 
    }
    int len2=jg.length();
    for (int i=0;i<len;i++){
        cout<<int(jg[i])<<" ";
    }
    return 0;
} 

|