Created
September 7, 2021 21:44
-
-
Save Rockbet/c219abbc5f2f89c26c7fb8b3807fe1aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
using namespace std; | |
int freq[26]; | |
int main(){ | |
ios_base::sync_with_stdio(false); cin.tie(NULL); | |
int n; | |
cin >> n; | |
string s; | |
getline(cin, s);// Note que usamos getline(cin, s) duas vezes, isso deve-se ao fato | |
getline(cin, s);// de, na entrada, após lermos o inteiro n, existe um '\n', que foi lido | |
// pelo primeiro getline. O segundo getline lerá a string s em si. | |
// Isso ocorre pois a função getline lê todos os caractéres até o primeiro | |
// caractére '\n' ser lido. | |
for(int i=0; i<n; i++){ | |
char c = s[i]; | |
if(c >= 'a' and c <= 'z') freq[c-'a']++; | |
} | |
getline(cin, s); | |
for(int i=0; i<n; i++){ | |
char c = s[i]; | |
if(c >= 'a' and c <= 'z') freq[c-'a']--; | |
} | |
bool resposta = true; | |
for(int i=0; i<26; i++){ | |
if(freq[i] != 0) resposta = false; | |
} | |
if(resposta) cout << "S\n"; | |
else cout << "N\n"; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment