Pastebin
API
tools
faq
paste
Login
Sign up
SHARE
TWEET
codeforce - String Coloring (easy version)
jakaria_hossain
Feb 5th, 2020
142
Never
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!
C++
0.59 KB
raw
download
clone
embed
print
report
RAW Paste Data
#include<bits/stdc++.h> using namespace std; #define ll long long #define fast()(ios_base::sync_with_stdio(0),cin.tie(NULL)); int main() { fast(); int n; string s,res; cin>>n>>s; char last0='a',last1='a'; for(int i=0;i<n;i++) { if(s[i]>=last0) { res+='0'; last0=s[i]; } else if(s[i]>=last1) { last1=s[i]; res+= '1'; } else { cout<<"NO"<<endl; return 0; } } cout<<"YES"<<endl<<res<<endl; }
Public Pastes
Lab3. 2
C++ | 2 min ago
Test touch screen
Lua | 14 min ago
Основы С++ / Тема...
C++ | 27 min ago
Untitled
C | 28 min ago
Untitled
C# | 42 min ago
SLA Email Alert
C | 43 min ago
Paste Ping
C | 48 min ago
Unity Task Handler
C# | 1 hour ago
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
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!