2012年7月6日金曜日

AOJ Volume0 0077: Run Length

/********************************
*    2012/05/16                    *
* AOJ Volume0 0077 Run Length    *
* wrote crane                    *
*********************************/

#include<string>
#include<sstream>
#include<iostream>


std::string input;
std::string output;
int main(){

    //while(getline(std::cin, input) && input.length() != 0){
    while(std::cin >> input){
        output="";        //出力用文字列初期化
        int i=0;
        while(i < input.length()){
            if(input.at(i) == '@'){
                int tmp;
                std::stringstream ss;
                ss << input.at(i+1);
                ss >> tmp;       
                for(int j=1; j<tmp; j++){
                    output += input.at(i+2);
                }
            i++;
            }else{
                output += input.at(i);
            }   
        i++;
        }
        std::cout << output << std::endl;
    }
    return 0;
}

0 件のコメント:

コメントを投稿