-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
108 lines (97 loc) · 2.36 KB
/
test.cpp
File metadata and controls
108 lines (97 loc) · 2.36 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
void ReadTXT(){
// AVLtree avl;
ifstream in;
string ch="";
in.open("dictionary.txt");
while (!in.eof()){
// AVLnode* temp;
getline(in,ch);
cout<<ch<<" ";
// avl.insert(temp->data,avl.root);
}
in.close();
// return avl.root;
}
void letteromit(string str){
// for(int i=0 ; str[i] !='\0' ; i++){
for(int j=0 ;str[j]!='\0';j++){
string temp ="";
for(int k=0 ; str[k]!='\0';k++){
if(k==j ){
//skip
}else{
temp+=str[k];
}
}
cout<<temp<<" ";
}
cout<<endl;
// }
}
void letterSubs(string str){
// char ch = 65;
//65 - 90 && 97-122 // 50 letters
for(int j=0 ; str[j] !='\0';j++){
string temp = str;
for(int i=65;i<=122;i++){
temp[j] = i;
// string ss = dict.search(temp);
// if(ss !=""){
// stk.push(ss);
// }
if(i==90){
i=96;
}
cout<<temp<<" ";
}
cout<<endl;
}
}
void letterinsert(string str){
for(int i=65;i<=122;i++){
for(int k=0; str[k] !='\0';k++){
string temp = "";
for(int j =0 ; str[j]!='\0';j++){
if(k==j){
temp+=i;
}
temp+=str[j];
}
cout<<temp<<" ";
}
if(i==90){
i=96;
}
cout<<endl;
}
}
void letterReversal(string str){
for(int i=0;str[i]!='\0';i++){
string temp = "";
for(int j=0;str[j]!='\0';j++){
if(i==j && str[j+1] !='\0'){
char te = temp[j];
temp+=str[j+1];
temp+=str[j];
j++;
}else{
temp+=str[j];
}
}
cout<<temp<<" ";
}
cout<<endl;
}
int main() {
// cout << "Hello, World!" << endl;
// ReadTXT();
letteromit("catt");
// letterinsert("plce");
// letterinsert("12345");
// letterReversal("paernt");
return 0;
}