Day 3 solution, plus some mucking about with the template code.
This commit is contained in:
parent
355f5f6628
commit
0e22e82652
300
2022/input/day03.txt
Executable file
300
2022/input/day03.txt
Executable file
|
@ -0,0 +1,300 @@
|
||||||
|
FzQrhQpJtJMFzlpplrTWjTnTTrjVsVvvTnTs
|
||||||
|
mScqSqqgcfPCqGPZcfGNSvTNsVVNSjNvWSNsNz
|
||||||
|
fPcPGqgCcHgFzQpJJtHtJH
|
||||||
|
DZDqqlrjplDHrNCmnBcHBMCRcJzb
|
||||||
|
RQFLStFvdcBbzdJbJM
|
||||||
|
PThQtwftTPFvtTPhvtFtfFtpZZllwjRNlsqNqqZjwpGlrZ
|
||||||
|
pPwtqgwJZPJLgQqSFlqhFFlqMd
|
||||||
|
DBmCWBBDWTRGvcVRTCCnnfQlFSdlzfhfdMWQfjhhQz
|
||||||
|
drmBVVCRgprPtrZp
|
||||||
|
HznjQjvmzDMVrQnMLJMMlfWgPSlJGWWJPl
|
||||||
|
BdcqqhcdBRpFhhZBthhctdJSJJWfgGFlJCSFgbWPCDJS
|
||||||
|
NdRTZdNqBwqtthpRBTTRqdtZrsLQVzrrzjzDwDsnmrQrnsrr
|
||||||
|
HZFZCFzZWszqsRTBZTNMhmthVTmhDppmMQVPpm
|
||||||
|
wjvSbJddvrvlrvnJSJJvlJmhPlhVPVtGVpQDBVMpphQP
|
||||||
|
frbrfrcvvnvjfwbcJgrrCBRsCFsNzRgRCHCqssRH
|
||||||
|
dDFNqNqZqPLNqvqTTvCLSPdZssGHClJQJcRHJGHHcHBcsMsQ
|
||||||
|
lrjmWgWWrhjgrppQHHMQrsQRJGcBJc
|
||||||
|
lVlmnwjmdTTSvVFN
|
||||||
|
FWNFHvQPmLGwwwSHtswwln
|
||||||
|
RfMJcDdfdcfdddfZjdchrtZmSmCZVtqVnZmrnrtC
|
||||||
|
JMmJcfjjphcghpgjhRGzGzBBGPFGNBvPTpFL
|
||||||
|
cVPVwStmmcQPBQPpSCppwhHZNNqHszNBhsNRNjqHzj
|
||||||
|
MfWdDgvdbnvgMTWgvgZfzmsZJHzNhqjqjRhJ
|
||||||
|
MDWMWGndMgFDnFLDwQrPPCSrCSVrlmGS
|
||||||
|
QLZmPdRdWmMsMDWZmsLWWrhMHcHGzHvGzFcvrvzNrc
|
||||||
|
tplSbLVBlvHHcFNnSr
|
||||||
|
VqfgwLlCJWmWQTfW
|
||||||
|
nRWvlvRbtLvdMCPFGL
|
||||||
|
wrfsJNNGhNzGrTgDMDLgPMLPfq
|
||||||
|
wcVhJQhwhrrBpmVblBRGSG
|
||||||
|
HHHcggrZLcQQcQll
|
||||||
|
GzfzTRTzmmFMwSNSwdSJQtNLNB
|
||||||
|
TGbmLMFTzVVVTMzmFMfFPMHPZhnjZCpHnhgnZnPWCPZZ
|
||||||
|
MRwwpVMHRspqVqwmccDlDrcHBBZgBl
|
||||||
|
jQfQQQjWWFBgmcgDfcZg
|
||||||
|
hvvSQzSnQQSWWQWSjTZVTRMshwVCssppwV
|
||||||
|
pvrTvCvtFppCHMMZcdDFdcZM
|
||||||
|
wLjTQnqljjSnlwjqjRgLcHHHMBDMZhBMHgHcbBDh
|
||||||
|
mqjqlSNqRqwSRrWCvzGmtfTfzs
|
||||||
|
TWScDCqCQQVBWDqWHsHswwBgRJzRhhHp
|
||||||
|
dPttGrvFfGjMjnjvshsJgsJLgghRgH
|
||||||
|
rFMlGdtjPffNnnrffSNcVCDqQqCQRqQRRN
|
||||||
|
GmBRbVpPbmJcwggBBgWW
|
||||||
|
LjsTCNNtddjHqLLgWwccqgfq
|
||||||
|
nsjNjntNtjHCsDwZmwZZVmmGSvSD
|
||||||
|
bwDDgNFtMMDbFsMbFwWWVcRcSpcgjgQWhWSp
|
||||||
|
lfTJJlvdfCffccWppRjRlcSc
|
||||||
|
RnzGdJJmsMNnMFtM
|
||||||
|
bsBTFsqqTTmFZTsQBWWznWCRshlJNJlCVh
|
||||||
|
GjGnDvDjvjPppHwwpwgrPPClJhNVRCzhhzJWlWlhNlvJ
|
||||||
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MGQRMLLM
|
||||||
|
qnrqppFVHphqfDsNbzjrzbrN
|
||||||
|
cwgDrdLSrBrvvhDzCljjTW
|
||||||
|
VHtVZpspQtMQsVRQppFVQVHtCdPTPTzdjvhTzTTPRvjjvWhn
|
||||||
|
QQZpMdJsQFJHtMHdScwLwLJGrSScSwqw
|
||||||
|
ZsjNflGfRfRPrZNRFcffLwJdwcLdDBnwzzzDznVn
|
||||||
|
CTGvhhTqbtbgTqLJWdDntzWWdnLw
|
||||||
|
phCMgmQGvvHCvMhbTQQFsNsNFPZSfZjffmNsll
|
||||||
|
CNpCJHLNhhSSHZPgrFlFFWgpFpmzjj
|
||||||
|
qQttDVDwQGdQGvqDQfwbcVrrlljjzzmzrVJgrr
|
||||||
|
nvMDsqqqQvfvsqDnRSZHJPPZHhLHLS
|
||||||
|
RNNrrPfDNRQwQhjscghMqs
|
||||||
|
WVZlHvnZqtlLVLvwjwhsggTstMhwTw
|
||||||
|
vGHWLJlVWlmLVqRCGCFFNfqqGf
|
||||||
|
MNzqCnvqvqvCVLBvvCVCpVcRssncrPSTWGrPSPdGTcrP
|
||||||
|
hmHwFmQjFlhtZmHwtZjjddSSGcsdPrrGcQQQRGPW
|
||||||
|
fHbbFjlhZwmtwhfjmmwmmLbpLqzqvBzLzCvLNRMbNB
|
||||||
|
tQfLrtQPrrfDSSCVlDfLSrmbBjGvWjjLmWWWpWNNppmv
|
||||||
|
wdHhRTTndnRThdvnBFGpNBMnpvvp
|
||||||
|
JdqTHTHHRdqzsJRRzTRHscJdDSGCfDlqQZqlfZrZZCffqSSQ
|
||||||
|
hQMWLsgGJMMhsCHggQWhgspDWFPzZvPvptDvzvmtdtdF
|
||||||
|
BrBlrTBrNRbfnjNQlZDztPvpmpppmzvfdd
|
||||||
|
jQlQlqQVbVcsMgMgChhJVs
|
||||||
|
MtFMCTWRFRRtCRTTRTMGJddjLdstHvBzBHzHVVpL
|
||||||
|
lZSDnbDlnZPrbHpzJJsdSVJpBL
|
||||||
|
nNghhP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CPd
|
||||||
|
gfzvSsftgQHQHgQl
|
||||||
|
GVbHRRGRLpdmGWTm
|
||||||
|
gSPPltPlrlvccFccPlcJNCTpnnmpMCLMMmWfdRmMSS
|
||||||
|
FzNJRhhvPFRvQwzqjqzBHZZj
|
||||||
|
PhZSpFBPBFsNmjBVllltBj
|
||||||
|
JMGLnrrnbfffrdqRqPHnnqLDVTDDjgmRgwtmjDljlDVlwl
|
||||||
|
LHMqPqPnnqGLWJPMnndrGfSWppzvvFSChFFFvvzQSQZz
|
||||||
|
RSWWssbvnnCqZnWsRCnssWrTggNhgbNHBgQjhhQBgjNT
|
||||||
|
mcpzcppzczcDGVcPcDLLGLjmrMNTNtQNHhMHrQBQNTgN
|
||||||
|
LVpPfcjjWvsFFnFf
|
||||||
|
MpddpdCpJdJlbdMvBHMnnsHqSRvG
|
||||||
|
PWvZfFmZrrfmwWwFznBnqRRSGcsBVmVBRG
|
||||||
|
zjzzhQPQvzjLPQzwffrwrtlTCDtJDlgJLltpTTJlTl
|
||||||
|
TvTWjjzpznGttFFZccrrPrSZllcB
|
||||||
|
gNNSqHMqsMHQJHNZCDDCZDqLZdlZBD
|
||||||
|
SMQNSRNbRRHwhwhsRmtnvWVmmnbGnjmpGn
|
||||||
|
ccSVQjCQddTsFJcH
|
||||||
|
gLppBfgfmvCRFdsddTJJgb
|
||||||
|
WMLMmWGGBZWZLCtvDhlSSDGlwhSPSzSP
|
||||||
|
TpqVGVHFQGmqSqPZdccNCzzhdwCjNG
|
||||||
|
fffbbvftMrBMDDcCccCZCjlvhCCd
|
||||||
|
RLWMnbftDhnMRtfBftRJMtLMgFgHmmpmPmSmmQFPPLHHVTQS
|
||||||
|
nRvwQSDNcpVJJcJR
|
||||||
|
qZMjBhjhZMMBzLBGLGrjJbTPVTpbdPPdVbVb
|
||||||
|
ZZpmFFZlfGqfmmGMzlfmMmnWQDtHtSvnWWNSHSSstFtS
|
||||||
|
bFDGZjGDbbRSgLtN
|
||||||
|
CphJVfJWCTBgvfLHNRcwnt
|
||||||
|
WVhPWBTzzChzhhhBmrpPPCJZDQtdMlrjFQdrFqsjdrQsFG
|
||||||
|
ZBpVQHHVMMWWdmmLWw
|
||||||
|
lQhhrjcRttrqbvQLNwdDWzmNSDmStz
|
||||||
|
QbGqhcbvcsqvCCHnsCZHCnTn
|
||||||
|
tlWtQTTTJjTQtVnmrbnPWVShVC
|
||||||
|
MDMGGzsHcwFgGZBqrmmPSnbqVmNVGC
|
||||||
|
sZFPwHcMZDBRTlvQQJttTQTR
|
||||||
|
FhVRfGptMGMnZhRFBNRBCCNHHNvTNTRC
|
||||||
|
zmwrLLSjrbzmNlcvvrHvDPCN
|
||||||
|
JLwjQdSbjdbSdqJQFGVqFVMgnGHMfGVV
|
||||||
|
fffZWrJqZSHWTWHqSvrgDhggzRjttsDhpDgs
|
||||||
|
PGlBLcBBbnnbLLFbGLBjRgjFTFVzshtzpgsppz
|
||||||
|
TGCPnMPQlGnPmclPlnnQmbmHJvNvfHdqwddwvvZfCNHCfW
|
||||||
|
ClLwpspTPrTFZCdzFbZdbQ
|
||||||
|
RRMWfRgWVRMRQBZZScVczVGFbjNb
|
||||||
|
MfnvMqWmslvDhQPw
|
||||||
|
hdndSdqsTddBhdcmmNHFDcqHttPF
|
||||||
|
JjMzzMZQGwZGZJzMzZJQzGJFvPvNPtFmvmNmDvcFtvDHMv
|
||||||
|
gZwzQwJfGVJQJbGLBsSTSTdTbCWDBSnd
|
||||||
|
ZZCHZRzMZGRMhMMVVFNThrdd
|
||||||
|
SgsccSPmmgqssSlqsgcmscSqlhpFdVThjphNrdrhjdwdhFJN
|
||||||
|
vmttqTcqvLqqmPccmqSBbRWnWzQZZZZBHnQCzHDH
|
||||||
|
GgPnGdSPBpGsLTBL
|
||||||
|
rVNJjmwZqtZZshltFTtvRFsL
|
||||||
|
mqmWrZVqWjrqZMNwPMQQbsddgdsbsgPz
|
||||||
|
LZLVvjZrggHLJggSZDgrnPnQnRnppVRllntRdPFz
|
||||||
|
chMCzbqGmhNhhbBCMBdFnpfqFnltRRQnlPpQ
|
||||||
|
TChmWcMMTmBswJzZZrWrvzgg
|
||||||
|
gngRNBNRBsNFFBgfgbLLLnqdSLvLTcbLbd
|
||||||
|
GWtlChlVMllcZSDWSLbdZL
|
||||||
|
lljjGlhMGrGJpsFdRJfsfzfz
|
||||||
|
jVTdrnGQcQtTTTFQqBqsgHHFgsqf
|
||||||
|
ZZLbPLzDzPZCmsgqsBHt
|
||||||
|
wDzDlPblRDPLPvhvwtdnnhdrnrMGWMVGMThj
|
||||||
|
spjjpjvjpjmQjrpCMfSlfzrPBl
|
||||||
|
dHFntHWnnbRVFtnbcqHFzBCCCPzfPMlcCSlgllzc
|
||||||
|
RLbVWHnnSWtnHFbdbVRdNNtQsjsQTjDLwmGTmTssQwmLGJ
|
||||||
|
JbJJSLMhRMSLhNqqwFDwFNcFqL
|
||||||
|
GcpnGnznnpzpzGpffNTNTwTfwdDNNdTFdD
|
||||||
|
nllnlPGWQWHcGpzzQGGzGvHGJbVVtJSChQVbmtmVJrmrmbRm
|
||||||
|
GFsFrzwrflmtdtbltG
|
||||||
|
ggLPDngCJncNLJRDwgnllmJqjWMjhjhjWWmWjj
|
||||||
|
nBNRNPgpRgDLTgNwfsSHVBQHVHwsZr
|
||||||
|
WwvnvWvcFtwtSFSF
|
||||||
|
zBZZZRQSzMBSgSVJGjGTPTGFzCzmmj
|
||||||
|
fZDrpZZfRfMgSQDDBhgQghDHsnbrcNlWnnLWHLrHsWnllc
|
||||||
|
ZVncdPPwVPdhZngnqHWHNNvTHvlMvn
|
||||||
|
fSLjjLSGGBjTTHqvBqrMNT
|
||||||
|
RSSSDGRtSGZthTTctmtg
|
||||||
|
rtzrfJbgJHRfGRZLPR
|
||||||
|
hdVhlllmFlFPLwHmsRGGZP
|
||||||
|
nTWhRjTBTWlvNQgnJSSbrJtz
|
||||||
|
JgVTpBpfvgpTDDJFJvTgggtlFlNNMRLNNzNNZRNHMRCLlF
|
||||||
|
wbPWcSGbGqWDlnNWMMMCLMWZ
|
||||||
|
wrsGcbrcbcqwDwbcmGvQBQgTTsdVJgJsVdQf
|
||||||
|
mztrhgJtDrhgcrZmnhbnzbhcMTMPlBCPBGVGTMVGslCCPGDs
|
||||||
|
FLRQmjjFSQpQwLlPsMsCpvslvPCB
|
||||||
|
fNLLwSdSwWSWjwmrtczZhhrJzdzh
|
||||||
|
HHwCwJFmHZttZCfCSffSMHcVDMcPBRPcPRDhPghM
|
||||||
|
nvQLsTnLslnLvpzGTssnsRPDMhPgVPVgtcVMRPgVQQ
|
||||||
|
vnsTGWlTLsWTLLvNsGWlsZrwmZCJddjFmtJJNZFftj
|
||||||
|
hbjSTvSJTfcSwcPSPfTbfHszVVFpGnpJpsHFnHVVls
|
||||||
|
rtZrcQrRZZQrmZBQlCGppnppHzpVFCGR
|
||||||
|
WmLqmgNtcLNQWTbPvfPwbbdb
|
||||||
|
HzZgsdHglHlzdHsFtsNNJSlNcSpjcjlrrNVv
|
||||||
|
wqqWRPPqwmbcqPjQVvSPJJrVpv
|
||||||
|
qqBBqmWRhqRLqcBnhzzztgnTdDHnHsFsHn
|
||||||
|
rJPFVwwsrJwmdVrLWJvvRBWBvbzWlb
|
||||||
|
nDZcNGNpjTpHncvpZCDnTNZGhlWzQhWbpRRQlQhpWWSWLlQb
|
||||||
|
CDNntnCCHnvmqPfwtFdVqd
|
||||||
|
gqBwgBjCswwgqNBNCVDDTVdhlSDTDcZc
|
||||||
|
HvRRFMzRRRRMpHrtTllfhZHHSShHTf
|
||||||
|
PmlGLPrppMrrmFFmLMWRjbsjnsjwQNJWnbQjWgBN
|
||||||
|
pDggpFgRghZjBFPPnPPFrt
|
||||||
|
cwTfLwBVwCWbLcVTVVvrdndGjMHrnGJtnttdMC
|
||||||
|
NTVcWNvcBSpgNqspRQlN
|
||||||
|
DLDgFlDmNZfjfnJZSF
|
||||||
|
tctvttzvGGzvrHqtVVdwnJGSSnnjjZdWTdwW
|
||||||
|
zvpcrbpHpqJJsPbPlLlhmhglPQ
|
||||||
|
pvHHvssFCFZQNCftttdQdd
|
||||||
|
VgTGTTVGgLjDjlLGzgPVMTNwmcwQmMQfQtmdcmwMJwNm
|
||||||
|
TPjTDjfGWTLLljgzrWpZZbsqrFqhqbps
|
||||||
|
ppVLcfcwSLgpSLVLgWwtfshDNDqvWvGvlQZvDNHQHjqq
|
||||||
|
MPrzmdRrPPrCJFnMnMRRFRPdqqZQNQvjvZDGDlHhQvGNDG
|
||||||
|
BmBMBBJTMmPBJMMFCCFJRmrsTlVpVbpwLSVwLsgcwTVlVc
|
||||||
|
SSGzmFRzmRGLgSSmGMJFnvfvJnJVnJQnMl
|
||||||
|
cBpjHtjwNfcpNZtppHtCMlMPMlJBVlVQlvJPvJ
|
||||||
|
dNtNZwqWfqtqZWtHttsqHqrRrrdRTLbmmzSLmTGGmbrg
|
||||||
|
RrrddnrgnRbbgWdGrfnwgQwjDjDpvTpBQTwBPP
|
||||||
|
MHCStZJzSwvPjWQD
|
||||||
|
mcJWVHCCLcGLbdcn
|
||||||
|
PlMsdjPdGMjdPSrSjgddbLbmHHTszHZzpHmsTFvmpzZzmN
|
||||||
|
ntRJQVRfcQhcQWhnchBJWntTFTTTNTSpFtztmZFDTpDZ
|
||||||
|
hQfcfCBSwCccVJhSJnrPPGLqPlbPLCrqldgb
|
||||||
|
vgvWDMZvGpcqgqsP
|
||||||
|
tSdtjLHLQLHjdFdDddQSQhwlsGqwQlqqqhQsPhGc
|
||||||
|
tbRjtTLFRvTZDBrMrV
|
53
2022/src/day03.rs
Normal file
53
2022/src/day03.rs
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
use std::io;
|
||||||
|
use std::vec::Vec;
|
||||||
|
use std::collections::HashSet;
|
||||||
|
|
||||||
|
use crate::utils;
|
||||||
|
|
||||||
|
pub fn execute() -> Result<(), io::Error> {
|
||||||
|
let mut score = 0;
|
||||||
|
let mut sacks: Vec<HashSet<u8>> = Vec::new();
|
||||||
|
|
||||||
|
for line in utils::read_lines("input/day03.txt")? {
|
||||||
|
let text = line?;
|
||||||
|
let (text1, text2) = text.split_at(text.len() / 2);
|
||||||
|
let mut pouch1 = HashSet::new();
|
||||||
|
let mut pouch2 = HashSet::new();
|
||||||
|
for i in 0..text1.len() {
|
||||||
|
pouch1.insert(text1.as_bytes()[i]);
|
||||||
|
pouch2.insert(text2.as_bytes()[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
let intersect: HashSet<_> = pouch1.intersection(&pouch2).cloned().collect();
|
||||||
|
score += get_score(&intersect);
|
||||||
|
|
||||||
|
sacks.push(pouch1.union(&pouch2).cloned().collect());
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut score2 = 0;
|
||||||
|
for group in sacks.chunks(3) {
|
||||||
|
let mut intersect: HashSet<u8> = group[0].intersection(&group[1]).cloned().collect();
|
||||||
|
intersect = intersect.intersection(&group[2]).cloned().collect();
|
||||||
|
score2 += get_score(&intersect);
|
||||||
|
}
|
||||||
|
|
||||||
|
utils::print_step(1, score as u64);
|
||||||
|
utils::print_step(2, score2 as u64);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_score(intersect: &HashSet<u8>) -> u32 {
|
||||||
|
if intersect.len() > 1 {
|
||||||
|
panic!("More than one overlapping item.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(item) = intersect.iter().next() {
|
||||||
|
if *item > 0x60 {
|
||||||
|
return (*item - 0x60) as u32;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((*item - 0x40) + 26) as u32;
|
||||||
|
}
|
||||||
|
|
||||||
|
panic!("No items in intersection.");
|
||||||
|
}
|
|
@ -1,11 +1,12 @@
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
mod utils;
|
||||||
|
|
||||||
const LATEST: u8 = 2;
|
const LATEST: u8 = 3;
|
||||||
|
|
||||||
mod day01;
|
mod day01;
|
||||||
mod day02;
|
mod day02;
|
||||||
// mod day03;
|
mod day03;
|
||||||
// mod day04;
|
// mod day04;
|
||||||
// mod day05;
|
// mod day05;
|
||||||
// mod day06;
|
// mod day06;
|
||||||
|
@ -34,7 +35,7 @@ fn main() -> io::Result<()> {
|
||||||
match day {
|
match day {
|
||||||
1 => day01::execute(),
|
1 => day01::execute(),
|
||||||
2 => day02::execute(),
|
2 => day02::execute(),
|
||||||
// 3 => day03::execute(),
|
3 => day03::execute(),
|
||||||
// 4 => day04::execute(),
|
// 4 => day04::execute(),
|
||||||
// 5 => day05::execute(),
|
// 5 => day05::execute(),
|
||||||
// 6 => day06::execute(),
|
// 6 => day06::execute(),
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
mod utils;
|
use std::io;
|
||||||
|
|
||||||
|
use crate::utils;
|
||||||
|
|
||||||
pub fn execute() -> Result<(), io::Error> {
|
pub fn execute() -> Result<(), io::Error> {
|
||||||
|
for line in utils::read_lines("input/day03.txt")? {
|
||||||
|
let text = line?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@ use std::io;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
|
||||||
fn read_lines(filename: &str) -> io::Result<impl Iterator<Item = io::Result<String>>> {
|
pub fn read_lines(filename: &str) -> io::Result<impl Iterator<Item = io::Result<String>>> {
|
||||||
let file = File::open(filename)?;
|
let file = File::open(filename)?;
|
||||||
Ok(io::BufReader::new(file).lines())
|
Ok(io::BufReader::new(file).lines())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_step(step: i8, value: u64) {
|
pub fn print_step(step: i8, value: u64) {
|
||||||
println!("Step {step} solution: {solution}");
|
println!("Step {step} solution: {value}");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user