File tree Expand file tree Collapse file tree 1 file changed +75
-0
lines changed Expand file tree Collapse file tree 1 file changed +75
-0
lines changed Original file line number Diff line number Diff line change
1
+ // JAI BAJARANG BALI
2
+
3
+ // manitianajay45
4
+
5
+ // give me some sunshine, give me some rain, give me another chance to grow up once again....
6
+
7
+ // sab moh maya hai....
8
+
9
+ #include < bits/stdc++.h>
10
+ using namespace std ;
11
+
12
+ #define ll long long
13
+ #define ull unsigned long long int
14
+ #define mod 1000000007
15
+
16
+ int main (){
17
+ ios_base::sync_with_stdio (false );
18
+ cin.tie (NULL );
19
+
20
+ string s;
21
+ cin>>s;
22
+ ll n=s.length ();
23
+
24
+ string ans=" " ;
25
+
26
+ map<char ,ll> mp1;
27
+ mp1[' A' ]=1 ;
28
+ mp1[' C' ]=1 ;
29
+ mp1[' G' ]=1 ;
30
+ mp1[' T' ]=1 ;
31
+
32
+ map<char ,ll> mp2;
33
+ mp2=mp1;
34
+ ll cnt=0 ;
35
+ for (ll i=0 ;i<n;i++){
36
+
37
+ if (mp2[s[i]]==1 ){
38
+ mp2[s[i]]=0 ;
39
+ cnt++;
40
+ }
41
+ if (cnt==4 ){
42
+
43
+ // cout<<i<<endl;
44
+ cnt=0 ;
45
+ mp2=mp1;
46
+ ans+=s[i];
47
+ }
48
+ }
49
+
50
+ // cout<<ans<<endl;
51
+ bool check=false ;
52
+
53
+ for (auto i:mp2){
54
+ // cout<<i.first<<" "<<i.second<<endl;
55
+ if (i.second ==1 ){
56
+ ans+=(i.first );
57
+ check=true ;
58
+ break ;
59
+ }
60
+ }
61
+
62
+ if (!check){
63
+ ans+=" A" ;
64
+ }
65
+
66
+
67
+ cout<<ans<<endl;
68
+
69
+
70
+
71
+
72
+
73
+
74
+ return 0 ;
75
+ }
You can’t perform that action at this time.
0 commit comments