Advertisement
Mlack

isdiget

Nov 25th, 2011
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.         string in;
  9.         int i=0,f=1;
  10.         cin>>in;
  11.         while(i<in.length())
  12.         {
  13.                 if(isdigit(in[i])!=0)
  14.                 {
  15.                         if(isdigit(in[i+1])!=0)
  16.                         {
  17.                                 f = (in[i]-'0')*10 + (in[i+1]-'0');
  18.                                 for(int a=1;a<f;a++)
  19.                                 cout<<in[i+2];
  20.                         } else {
  21.                                 f = in[i]-'0';
  22.                                 for(int a=1;a<f;a++)
  23.                                 cout<<in[i+1];
  24.  
  25.                         }
  26.                 } else {
  27.                         cout<<in[i];
  28.                 }
  29.                 i++;
  30.         }
  31.         cout<<endl;
  32.  
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement