hdu 1020

来源:互联网 发布:网上点餐软件 编辑:程序博客网 时间:2024/05/17 01:16
用map写了一发结果果断的WA了,然后发现并不需要对字符统计排序。。。
#include<iostream>using namespace std;int main(){int n;cin>>n;while (n--){string s;cin>>s;for (int i=0; i<s.length(); ){int c = 1;while (s[i] == s[i+1]){c++;i++;}if (c == 1){cout<<s[i];}else{cout<<c<<s[i];}i++;}printf("\n");}} 

0 0