Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define fastread()(ios_base::sync_with_stdio(false),cin.tie(NULL));
- #define pb push_back
- #define khela_hobe int main()
- #define bahir_ho return 0
- #define f first
- #define s second
- khela_hobe
- {
- fastread();
- int n;
- cin>>n;
- string s,ans;
- cin>>s;
- bool flag=true;
- map<char,int>mp;
- map<char,int>:: iterator it;
- for(int i=0; i<s.size(); i++)
- {
- mp[s[i]]++;
- }
- for(it= mp.begin(); it!=mp.end(); it++)
- {
- if(it->s%n!=0)
- {
- flag=false;
- break;
- }
- for(int i=0; i<it->s/n; i++)
- {
- ans.pb(it->f);
- }
- //cout<<<<endl;
- }
- if(flag)
- for(int i=0; i<n; i++)
- cout<<ans;
- else
- cout<<"-1";
- bahir_ho;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement