Advertisement
Josif_tepe

Untitled

Jun 7th, 2024
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     string s;
  8.     cin >> s;
  9.    
  10.     for(int i = 0; i < s.size(); i++){
  11.       if(isalpha(s[i])) {
  12.         if(isdigit(s[i - 1])) {
  13.           int brojka = s[i - 1] - '0';
  14.           for(int j = 0; j < brojka;j++) {
  15.             cout << s[i];
  16.           }
  17.         }
  18.         else {
  19.           cout << s[i];
  20.         }
  21.       }
  22.     }
  23.  
  24.     return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement