SHARE
TWEET

Untitled

a guest Oct 24th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4.   int i=0,k=0,z=0;
  5.  string s;
  6.   cin >> s;
  7. for(int i=0;i<s.size();i++){
  8.   if(s[i]=='1'&& i==0) cout << 'a';
  9.  if(s[i]=='1' &&i>0)
  10.   {
  11.      
  12.     z=i;
  13.     i=i-1;
  14.     while(i>0){
  15.       if (s[i]=='1'){
  16.         k=i;
  17.          
  18.         break;
  19.       }
  20.       i--;
  21.     }
  22.     if(s[0]=='1'){
  23.     cout<<(char)(97+z-k-1);
  24.  
  25.     }
  26.     else cout << (char)(97+z-k);
  27.     i=z;
  28.   }
  29.   }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top