-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcodvita1.cpp
More file actions
51 lines (44 loc) · 881 Bytes
/
codvita1.cpp
File metadata and controls
51 lines (44 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <iostream>
#include <string>
#include <cstring>
#include<bits/stdc++.h>
using namespace std;
int main() {
string l,s,v,w,num;
getline(cin,l);
getline(cin,s);
transform(s.begin(), s.end(), s.begin(), ::tolower);
transform(l.begin(), l.end(), l.begin(), ::tolower);
map<char,int> mp;
for(int i=0;i<l.size();i++)
mp[l[i]]++;
for(auto x:mp)
{
if(x.second>1)
{
cout<<"New language Error";
return 0;
}
}
for(int i=0;i<l.size();i++)
{
for(int j=0;j<s.size();j++)
{
if(l[i]==s[j])
v+=l[i];
}
}
for (int i = 0; i < v.length(); i++) {
if (isdigit(v[i])) {
num += v[i];
}
}
for(int i = 0; i< v.length(); i++){
if(isdigit(v[i])){
v.erase(v.begin()+i);
i--;
}
}
cout<<v<<" "<<num;
return 0;
}