Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
play-unfair
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marcela Ribeiro de Oliveira
play-unfair
Commits
05ab74d3
Commit
05ab74d3
authored
7 years ago
by
Marcela Ribeiro de Oliveira
Browse files
Options
Downloads
Patches
Plain Diff
mais uns filtros
parent
b72ebb50
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/playunfair.h
+4
-0
4 additions, 0 deletions
include/playunfair.h
playunfair.cpp
+63
-9
63 additions, 9 deletions
playunfair.cpp
teste2.in
+1
-1
1 addition, 1 deletion
teste2.in
with
68 additions
and
10 deletions
include/playunfair.h
+
4
−
0
View file @
05ab74d3
...
...
@@ -5,7 +5,11 @@
int
filter
(
std
::
string
text
);
void
parser
(
std
::
string
&
text
);
int
isVowel
(
char
c
);
int
isF
(
char
c
);
int
filter1
(
std
::
string
text
);
int
filter2
(
std
::
string
text
);
int
filter3
(
std
::
string
text
);
int
filter4
(
std
::
string
text
);
int
filter5
(
std
::
string
text
);
int
filter7
(
std
::
string
text
);
int
filter8
(
std
::
string
text
);
This diff is collapsed.
Click to expand it.
playunfair.cpp
+
63
−
9
View file @
05ab74d3
...
...
@@ -56,12 +56,13 @@ void parser(std::string &text){
int
filter
(
std
::
string
text
){
//TODO: if ( 4 primeiras letras sem vogal ||
// 3 char -('o') iguais seguidos ||
// 3 char -('o')
-('e') -('a')
iguais seguidos ||
// 5 consoantes ||
// 7 vogais ||
// 'q' + !'u' ||
// ('c'|'d'|'f'|'h'|'k'|'p'|'q'|'w'|'y') + !(vogal|'r'|'h')
//
// 'q' + !'u' + !vogal ||
// ('b'|'c'|'d'|'f'|'h'|'k'|'p'|'q'|'t'|'w'|'y') + !(vogal|'r'|'h'|'l') ||
// ('nh' + vogal || 'ch' + vogal) ||
// ultima letras b, c, d (download), f, g, h, k, p (hip hop), q, v (tv), w (show), y
// )
// { elimina texto: muda pra proxima chave}
if
(
filter1
(
text
)
==
REJECTED
)
...
...
@@ -70,8 +71,14 @@ int filter(std::string text){
return
REJECTED
;
else
if
(
filter3
(
text
)
==
REJECTED
)
return
REJECTED
;
else
if
(
filter4
(
text
)
==
REJECTED
)
return
REJECTED
;
else
if
(
filter5
(
text
)
==
REJECTED
)
return
REJECTED
;
else
if
(
filter7
(
text
)
==
REJECTED
)
return
REJECTED
;
else
return
filter
4
(
text
);
return
filter
8
(
text
);
}
int
isVowel
(
char
c
){
...
...
@@ -97,7 +104,7 @@ int filter2(std::string text){
for
(
i
=
0
;
i
<
text
.
size
()
-
3
;
++
i
){
char
l
=
text
[
i
];
int
lim
=
3
,
cont
=
0
;
if
((
l
==
'o'
)
||
(
l
==
'e'
))
if
((
l
==
'o'
)
||
(
l
==
'e'
)
||
(
l
==
'a'
)
)
continue
;
for
(
j
=
i
+
1
;
j
<
i
+
lim
;
++
j
){
if
(
text
[
j
]
==
'x'
){
...
...
@@ -123,7 +130,7 @@ int filter3(std::string text){
size_t
i
,
j
;
int
rej
=
ACCEPTED
;
for
(
i
=
0
;
i
<
text
.
size
()
-
5
;
++
i
){
int
lim
=
5
,
cont
=
0
;
int
lim
=
4
,
cont
=
0
;
char
l
=
text
[
i
];
if
(
isVowel
(
l
))
continue
;
...
...
@@ -137,7 +144,7 @@ int filter3(std::string text){
break
;
}
}
if
(
cont
==
4
){
if
(
cont
==
3
){
rej
=
REJECTED
;
break
;
}
...
...
@@ -169,3 +176,50 @@ int filter4(std::string text){
}
return
rej
;
}
int
filter5
(
std
::
string
text
){
size_t
i
;
int
rej
=
ACCEPTED
;
for
(
i
=
0
;
i
<
text
.
size
()
-
2
;
++
i
){
if
(
text
[
i
]
==
'q'
){
if
(
text
[
i
+
1
]
!=
'u'
){
rej
=
REJECTED
;
break
;
}
else
if
(
!
isVowel
(
text
[
i
+
2
])){
rej
=
REJECTED
;
break
;
}
}
}
return
rej
;
}
int
filter7
(
std
::
string
text
){
size_t
i
;
int
rej
=
ACCEPTED
;
for
(
i
=
0
;
i
<
text
.
size
()
-
2
;
++
i
){
if
((
text
[
i
]
==
'n'
||
text
[
i
]
==
'c'
)
&&
text
[
i
+
1
]
==
'h'
){
if
(
!
isVowel
(
text
[
i
+
2
])){
rej
=
REJECTED
;
break
;
}
}
}
return
rej
;
}
int
isF
(
char
c
){
int
result
=
0
;
result
=
(
c
==
'b'
||
c
==
'c'
||
c
==
'd'
||
c
==
'f'
||
c
==
'g'
||
c
==
'h'
||
c
==
'k'
||
c
==
'p'
||
c
==
'q'
||
c
==
'v'
||
c
==
't'
||
c
==
'w'
||
c
==
'y'
);
return
result
;
}
int
filter8
(
std
::
string
text
){
// ultima letras b, c, d (download), f, g, h, k, p (hip hop), q, v (tv), w (show), y
size_t
i
=
text
.
size
()
-
1
;
if
(
isF
(
text
[
i
]))
return
REJECTED
;
return
ACCEPTED
;
}
This diff is collapsed.
Click to expand it.
teste2.in
+
1
−
1
View file @
05ab74d3
oi
meu
nome
e
h
marcela
e marcela
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment